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 );
send with MSG_DONTWAIT and setrlimit in Windows
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:
If you always pass MSG_DONTWAIT, it's more efficient to put the socket in nonblocking mode once, and leave it there.
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.
Thanks!
Should I replace MSG_DONTWAIT with zero in windows?
send( socket, buffer, length, MSG_DONTWAIT );//linux
send( socket, buffer, length, 0 );//windows
Should I replace MSG_DONTWAIT with zero in windows?
send( socket, buffer, length, MSG_DONTWAIT );//linux
send( socket, buffer, length, 0 );//windows
Quote:Original post by akira32Yes.
Thanks!
Should I replace MSG_DONTWAIT with zero in windows?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement