Problem with loggin into server

Technical discussion about the NMDC and <a href="http://dcpp.net/ADC.html">ADC</A> protocol. The NMDC protocol is documented in the <a href="http://dcpp.net/wiki/">Wiki</a>, so feel free to refer to it.

Moderator: Moderators

Locked
r4v3
Posts: 22
Joined: 2003-01-14 16:24
Location: Poland

Problem with loggin into server

Post by r4v3 » 2003-01-14 16:41

Hello im writening a DC client but 1 have one problem with loggin in.
This is how I try to do this:
H-Hub C-Client

1)HUB->Lock
2)C->Key
3)H->HubName.........
4)C->ValidateNick .........
5)H-><Hub-Security> ............

Thats all , hub dont send any more messages.But when i write a small DC Hub and connected to it with DC++ it seems a little diferend:

1)H->Lock
2)H->HubName.........
3)H-><Hub-Security> ............
4)C->Key
5)C->ValidateNick .........

So i tryed to do the same with my client but with no results.. :(
If samone can help me it would be nice ;) , and i have 2 questions :
1)Why everyhub sends <Hub-Security>........... ?
2)Whitch ports uses clients with client-to-client connection ?

My lock->key function works with no problems , so i dont know what should I change.
Sorry for my English
GreetZ
Rave

TasMan
Posts: 196
Joined: 2003-01-03 08:31
Location: Canada
Contact:

Post by TasMan » 2003-01-14 17:22

Well this works for me :)

Code: Select all

H -> $Lock <something>|
C -> $Key <decodedfromlock>|$ValidateNick <myname>|

Hub may send if registered

H -> $GetPass|
C -> $MyPass <mypass>|
H -> $LogedIn <yourname>|$Hello <yourname>|

        ^ (maybe $Hello is before $LogedIn but it doesn't matter)

otherwise it should send to everybody (including yourself)

H -> $Hello <yourname>|
You're including the | and $ right? And your name in ValidateNick right? These are the only things that *should* be messing it up.....

Anyways if that didn't help, here's the rest of the answers to your q's...

The hub sends <Hub-Security>.... just to tell the user what's going on. It's a main chat message (e.x <Hub-Security> Your name is registered, please supply the password.|$GetPass| )

The client to client connection port vaires. NMDC uses 412 by default and DC++ 1412 (used to)...it doesn't matter though...it's the port you're listening for connection requests and search results (active mode only).

Sedulus
Forum Moderator
Posts: 687
Joined: 2003-01-04 09:32
Contact:

Re: Problem with loggin into server

Post by Sedulus » 2003-01-14 17:22

r4v3 wrote:1)HUB->Lock
2)C->Key
3)H->HubName.........
4)C->ValidateNick .........
5)H-><Hub-Security> ............
in my experience, it doesn't really matter.
as soon as you get the Key, reply with the $Lock+$ValidateNick in one packet. after that, send the $MyINFO when you are logged in (i.e. get the $Hello). if I'm not mistaken, the whole thing is rather state-less. (note that you may get a $ValidateDenide or a $GetPass, after which you'll have to reply appropriately)
r4v3 wrote:1)Why everyhub sends <Hub-Security>........... ?
afaik this is just a chat message... the neo-modus guys chose to call the sender Hub-Security.
r4v3 wrote:2)Whitch ports uses clients with client-to-client connection ?
this depends on the $ConnectToMe's, and may be any one of the 64k ports.
http://dc.selwerd.nl/hublist.xml.bz2
http://www.b.ali.btinternet.co.uk/DCPlusPlus/index.html (TheParanoidOne's DC++ Guide)
http://www.dslreports.com/faq/dc (BSOD2600's Direct Connect FAQ)

Sedulus
Forum Moderator
Posts: 687
Joined: 2003-01-04 09:32
Contact:

Post by Sedulus » 2003-01-14 17:24

ehe.. swap the `Key' and `Lock' in my post :-/
http://dc.selwerd.nl/hublist.xml.bz2
http://www.b.ali.btinternet.co.uk/DCPlusPlus/index.html (TheParanoidOne's DC++ Guide)
http://www.dslreports.com/faq/dc (BSOD2600's Direct Connect FAQ)

r4v3
Posts: 22
Joined: 2003-01-14 16:24
Location: Poland

thx

Post by r4v3 » 2003-01-14 18:48

Thx for fast reply , i'll try it tommorow and i'll give you sign.

Sid
Posts: 56
Joined: 2003-01-07 18:13
Contact:

Similer Problem

Post by Sid » 2003-01-15 14:09

I have had a similer problem to that. Most of the time my client logs in wiht out a problem but every now and again it hangs and the hub tempbans me. best i can come up with is there is a bug in the nmdc hub software.

-Sid

sandos
Posts: 186
Joined: 2003-01-05 10:16
Contact:

Re: Similer Problem

Post by sandos » 2003-01-15 14:25

Sid wrote:I have had a similer problem to that. Most of the time my client logs in wiht out a problem but every now and again it hangs and the hub tempbans me. best i can come up with is there is a bug in the nmdc hub software.

-Sid
Happens to me aswell.

aDe
Forum Moderator
Posts: 138
Joined: 2003-01-07 09:14
Location: SE
Contact:

Post by aDe » 2003-01-15 14:31

You're probably using luke-jr's lock2key sub..

it fails sometimes - resulting in the hub dropping and tempbanning you.

Atomic Jo
Posts: 62
Joined: 2003-01-04 03:50
Location: Québec, Canada
Contact:

Post by Atomic Jo » 2003-01-15 14:57

Indeed I noted too some dysfunctions in the routine of luke-jr. I
preferred the routine of SuxXx which is exact especially in the
calculation of the bits shift.

Protocol by SuxXx coming with opendcd:
http://opendcd.sourceforge.net/

r4v3
Posts: 22
Joined: 2003-01-14 16:24
Location: Poland

Post by r4v3 » 2003-01-16 14:03

Its ma again , i have the same problem as 2 they ago
When (H - hub , C - client)
H $Lock ........|
C $Key ..........|
H $HubName........|
C <do nothing>
H <HubSecurity>.................|
C <do nothing>

and this is all , hub dont send mi $Hello ....|
Me lock->key algoritm is ok (checked with DC++)
This problem is only with Neo Modus hub Software ,rest (except few others) login me normally.
Im trying to fix this for 3 days but i doesnt work
Im looking for some help... :)
Hub doesnt ban mi it just disconnect (exactly i dont know is it disconnecting or just sending still the same value about 6500)

Im writenig in Java (SDK 1.4)

I dont know C++ but i heared that string "abc" in java is
[a][c] but in c++ is [a][c][0] , maybe this is the problem ?

And one more question is this difference with :
send("abc|");
send("def|");
AND
send("abc|def|");

Uff thats all

ender
Posts: 224
Joined: 2003-01-03 17:47

Post by ender » 2003-01-16 14:20

you must send $ValidateNick after the $Key, after that, the hub will either answer with $ValidateDenide (the nickname is taken or it contains invalid characters), $GetPass (the nickname is password-protected), or $Hello.

BTW: there are two open-source Java clients out there already, you can learn from them: JavaDC and JavaOpenDC.

r4v3
Posts: 22
Joined: 2003-01-14 16:24
Location: Poland

Post by r4v3 » 2003-01-16 14:30

ok so now im doing it this way:
H:$Lock
C:$Key
H:$HubName
C:$ValidateNick
H:<Hub-Security>...

And hub doesnt send me $Hello...

ender
Posts: 224
Joined: 2003-01-03 17:47

Post by ender » 2003-01-16 15:09

Read another line from the hub - this is what I get if I connect to a hub with telnet (without sending anything):

Code: Select all

$Lock a?Kl0(@2X\nk(=?\@Lx;k+znDdA)AD,5+zubQnys.cbqO>bvy+r'C1IjE5.J]13gHmFNIV3Jv+ Pk=JIm4@X+I'J%Vuik^|$HubName Test|<Hub-Security> This hub is running version 1.0.25 of Luke-Jr's DC Hub (1500 max) Software.|||||
As you see, $Lock, $HubName and the chat message are sent immediately (Luke-jr's hub is just a hacked version of the Neo-modus hub - it behaves the same).

aDe
Forum Moderator
Posts: 138
Joined: 2003-01-07 09:14
Location: SE
Contact:

Post by aDe » 2003-01-16 16:29

well no.. you must actually type the nickname you want after validatenick
this is how it looks when it works

H $Lock ........|
H $HubName........|
H <HubSecurity>.................|
C $Key ..........|
C $ValidateNick thenickname|
H $Hello thenickname|

r4v3
Posts: 22
Joined: 2003-01-14 16:24
Location: Poland

Post by r4v3 » 2003-01-16 17:28

I do this exactly as u wrote but this f**** neo-modus hubs dont send me $Hello , they are closing connection(only neo - modus hubs) , but they dont ban me

I have next questions : :D

1)Each command must ends with "|" , but how should end whole message to hub for example
$abc|$def| ?

2)Does it difference between
$abc|
$def|
And
$abc|def| ?

Maybe hubs disconnects me beacouse Java and C++ sockets are different ? (I so DC clients in Java...)
If samone is programming in Java(SDK) please help

PS Did u all have as many problems as I with "stupid" client -> server communication ?

aDe
Forum Moderator
Posts: 138
Joined: 2003-01-07 09:14
Location: SE
Contact:

Post by aDe » 2003-01-16 17:35

1.) just use the | after each command. no need to terminate the whole string. (but you must terminate the last command)!

2.) no, it should not matter. I don't know for sure.. it seems it does matter when trying to handshake a dc++ client.. but thats different..

r4v3
Posts: 22
Joined: 2003-01-14 16:24
Location: Poland

Post by r4v3 » 2003-01-16 17:43

so now i really dont know what shoul i fix...
I written small DC+ hub - it shows everything what clients sends and i connected to it with my DC and DC++ and everything was the same.
I thing that it must be same problem with sockets so i should find someone who knows Java...

sandos
Posts: 186
Joined: 2003-01-05 10:16
Contact:

Post by sandos » 2003-01-16 19:15

r4v3 wrote:so now i really dont know what shoul i fix...
I written small DC+ hub - it shows everything what clients sends and i connected to it with my DC and DC++ and everything was the same.
I thing that it must be same problem with sockets so i should find someone who knows Java...
Ive done dc-programming in java, no problems whatsoever. Dont worry abouts sockets being different, they arent.

One thing to look our for though, mitht be character encoding. Java supports lots of differents ones, so when you are converting to bytes to send onto the network, it might be you are using a default encoding of ascii, which wont work. It should be "iso-8859-1" instead. Default encoding is different depending on locale on your computer I think.

ender
Posts: 224
Joined: 2003-01-03 17:47

Post by ender » 2003-01-17 04:12

Actually it should be Windows-1252, which difers a little from ISO-8859-1...

r4v3
Posts: 22
Joined: 2003-01-14 16:24
Location: Poland

Post by r4v3 » 2003-01-17 06:06

I'd like to thanx all of u , especially Sandos : u had right it was problem with bad encoding , now everything is ok and im so happy beacouse i can start writtening my DC .
Sorry for my ENG , but i hope u'll understand me.GreetZ

sandos
Posts: 186
Joined: 2003-01-05 10:16
Contact:

Post by sandos » 2003-01-17 07:57

ender wrote:Actually it should be Windows-1252, which difers a little from ISO-8859-1...
Thats weird, since all is fine using iso-8859-1 in java. I dont think there is any windows-1252 even. Hmm. :)

ender
Posts: 224
Joined: 2003-01-03 17:47

Post by ender » 2003-01-17 09:11

Windows-1252 is the Western Windows codepage. It differs from ISO-8859-1 in chatacters with codes from 128 to 160 (they're used in Win1252 but not in iso). Anyway, I'm only saying that this codepage should be used, since most people using DC use it. The only real difference will be seen with users who use special characters in their nicknames (to make them look stupid)... In theory, any single-byte codepage which has codes 0-127 the same as US-ASCII should work.

r4v3
Posts: 22
Joined: 2003-01-14 16:24
Location: Poland

Post by r4v3 » 2003-01-17 18:25

Yeap , im from Poland and im using Windows-1252 ,and in my alphabet are few leters that aren't "standard".
Sorry for my ENG , but i hope u'll understand me.GreetZ

ender
Posts: 224
Joined: 2003-01-03 17:47

Post by ender » 2003-01-17 20:00

Interestng, I'm using Windows-1250 (Central-European, I'm from Slovenia), thought Poland uses the same...

Locked