hmmm how can I tell the end of an $SR command? There is no |

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
MrGrim
Posts: 11
Joined: 2003-03-29 18:12

hmmm how can I tell the end of an $SR command? There is no |

Post by MrGrim » 2003-04-14 16:03

The subject pretty much says it all. There is no | at the end of a $SR command so how is it possible to know that we have reached the end? If I wait for the begining of another command (i.e. look for a second $) then I never get the last one ...

Marvin
Posts: 147
Joined: 2003-03-06 06:56
Location: France
Contact:

Post by Marvin » 2003-04-14 16:23

$SR command ends with the ip:port of the client that initiated the search process (a.b.c.d:e).

arnetheduck
The Creator Himself
Posts: 296
Joined: 2003-01-02 17:15

Post by arnetheduck » 2003-04-15 06:45

UDP always sends data in packets, each call to recv will give you one packet at a time, and it will contain the whole $SR...if I remember things correctly about recv that is =)

MrGrim
Posts: 11
Joined: 2003-03-29 18:12

Post by MrGrim » 2003-04-15 07:27

Marvin I'm afraid that is not correct. A $SR command ends with the IP of the hub the user is in in brackets. :( Plus, $SR is not the only command you will be receiving through the UDP port, so I need a solution that will work for all of them.

arnetheduck that sounds like a solution. You are saying that every time I tell the socket to return me the received data it will reply with a single packet even if it has received more than one, correct?

Thank you both for your replies.

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

Post by Sedulus » 2003-04-15 08:12

man 7 udp wrote: All receive operations return only one packet. When the packet is smaller than the passed buffer
only that much data is returned, when it is bigger the packet is truncated and the MSG_TRUNC flag is
set. MSG_WAITALL is not supported.
and if I remember correctly, the only other things than $SR you can recieve are $Ping's, but I'm not sure when and how they are sent[/quote]
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)

Locked