Advertisement

a little winsock questions

Started by June 25, 2003 11:08 AM
3 comments, last by Aragon 21 years, 7 months ago
hi @all i have an 3d engine running good and now i try to learn network programming to make it multiplayer....it works good, i have server and client funktion working but now i have little question how did i get the own IP adress in an string to show and/or use it ingame (at moment i use 127.0.0.1) i think it works with -> GetHostName() but it didnt work have anybody a simple example how to get it to run? another thing... at the moment i use tpc.. i found a command to disable the needle algo that ,like i understand, turn off waiting for returning tcp ok signal to send the next one -> TCPNODELAY i try it,but my server crash with it is this function good or useless....?! thx for any answer SVEN (sorry for my bad english)

for the needle turn off algo i try this:

BOOL wert_delay=1;

setsockopt (sClient,IPPROTO_TCP,TCP_NODELAY,(LPSTR)wert_delay,sizeof(BOOL));


but my app crashes with this ..whats wrong with it?
(p.s.: for that what i want to do i cant!! use UDP,
i only want to speed up tcp a little bit)
Advertisement
Yeah, nice of them to tell you two different things in the documentation... While the ''option'' you pass to setsockopt is indeed a logical boolean value, sending it a real ''bool'' type variable will cause problems. I offer you the following from MSDN:
quote:
To enable a Boolean option, optval points to a nonzero integer. To disable the option optval points to an integer equal to zero. The optlen parameter should be equal to sizeof(int) for Boolean options.

So pass in an int that is 1 or 0 instead of a BOOL.
FYI, it's Nagle, not Needle.

Also FYI, disabling Nagle algorithm comes with a hefty warning label, courtesy of Winsock Programmer's FAQ.

[edited by - foofightr on June 25, 2003 7:51:48 PM]
ah..aaaah...BOOL..that was my error , thx
(omg...i am so stupid )

it works perfect....
its speeds up my network data transfer
without have to use UDP

and now i found how to get the
own IP as an string

perfect


(i think i have to learn a better english
that will help me understand the documentations)





This topic is closed to new replies.

Advertisement