Jump to content
  • Advertisement
Sign in to follow this  
akira32

send with MSG_DONTWAIT and setrlimit in Windows

This topic is 3307 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a linux project but I want to change it to be a windows project.
I meet two probelm.

First, the windows'winsock does not have MSG_DONTWAIT. How do I transfer the code as below to windows syntax?

send( socket, buffer, length, MSG_DONTWAIT );

Second, which funcotion in windows map to the setrlimit function of linux?

struct rlimit rt;
rt.rlim_max = rt.rlim_cur = 50;
setrlimit( RLIMIT_NOFILE, &rt );

Share this post


Link to post
Share on other sites
Advertisement
First: You don't need the rlimit call. You can open more than 50 files anyway.

Second: The MSG_DONTWAIT option is equivalent to setting the socket in non-blocking mode for the duration of the call only. Thus, you can use ioctlsocket() in WinSock:

u_long iMode=1;
ioctlsocket(Socket,FIONBIO,&iMode);


If you always pass MSG_DONTWAIT, it's more efficient to put the socket in nonblocking mode once, and leave it there.

Share this post


Link to post
Share on other sites
Thanks!
Should I replace MSG_DONTWAIT with zero in windows?

send( socket, buffer, length, MSG_DONTWAIT );//linux
send( socket, buffer, length, 0 );//windows

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!