IRC's DCC Protocol, Help....

I understand I need use sockets to implement IRC's DCC protocol to my program. Here is the part I dont understand.

Here is a quick explanation on how DCC Works:

Data is sent in packets, rather than dumped in a stream manner. The recipient should acknowledge each packet by transmitting the total number of bytes received as an unsigned, 4 byte integer in network byte order.

My Question: How do I send the number of bytes I have received as an unsigned, 4 byte integer?

An Answer would be greately appreciated.
alexpetAsked:
Who is Participating?
 
julio011597Connect With a Mentor Commented:
What you need should be the htonl() function from the Winsock unit... at least i have it under Delphi 2.

Help on "htonl" gives:

--//--
The Windows Sockets htonl function converts a u_long from host to network byte order.

This function takes a 32-bit number in host byte order and returns a 32-bit number in network byte order.

u_long htonl (
  u_long hostlong
);

Parameters

hostlong
  A 32-bit number in host byte order.

Return Value

The htonl function returns the value in network byte order.

See Also

htons, ntohl, ntohs
--//--

HTH.
0
 
extremeCommented:
Your problem is to know how many bytes do you received, or how to pack this un a 4 butes unsigned integer?
0
 
alexpetAuthor Commented:
my questions is basically how to send the number of bytes recevied as a 4 byte unsigned integer?
0
 
extremeCommented:
What software to manage TCP/IP are you using?. Something like DWinsock? or you are handling TCP "at Hand"?
0
All Courses

From novice to tech pro — start learning today.