Jump to content

  • Log In with Google      Sign In   
  • Create Account


I dont understand ioctlsocket


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Anddos   Members   -  Reputation: 485

Like
0Likes
Like

Posted 23 December 2012 - 12:21 AM

I know what it is used for but i dont know what they mean by the function only returns when there is data sent?


:)

Sponsor:

#2 hplus0603   Moderators   -  Reputation: 5098

Like
0Likes
Like

Posted 23 December 2012 - 12:25 AM

ioctlsocket() is a general function to do socket control that cannot be done through send() or recv() or select() or similar. (There is also setsockopt())

 

Mainly, it is a portability shim for functions that on UNIX will go through ioctl(), which is a function that doesn't exist on Windows.

 

The specific functions of ioctlsocket() depend on the arguments you pass -- there is more than one thing you may be able to do with it. If you have a question about a specific function, mentioning how you are calling it, and what the results are, and what you expect the results to be (copy and paste a few lines of code) is necessary for anyone to be able to help.


enum Bool { True, False, FileNotFound };

#3 Anddos   Members   -  Reputation: 485

Like
0Likes
Like

Posted 23 December 2012 - 12:31 AM

i mean if i set a socket to none blocking, what is the diference when you send data to a blocking socket?, i know its set to blocking by default, btw thanks for the fast repyl.

I am following this tutorial

http://www.win32developer.com/tutorial/winsock/winsock_tutorial_4.shtm

i dont know why the developer has the client to recv and the server to send as well?

Edited by Anddos, 23 December 2012 - 12:52 AM.

:)

#4 Anddos   Members   -  Reputation: 485

Like
0Likes
Like

Posted 25 December 2012 - 12:48 AM

do you need to set this for both client and server ?

 

// If iMode!=0, non-blocking mode is enabled.
    u_long iMode=1;
    ioctlsocket(Socket,FIONBIO,&iMode);


:)

#5 hplus0603   Moderators   -  Reputation: 5098

Like
0Likes
Like

Posted 26 December 2012 - 05:58 PM

do you need to set this for both client and server ?
 
These functions have nothing to do with the network. The packets on the network won't change. It only changes how your application (server or client) talks to the network stack. Whether you want to set a socket into non-blocking mode on a client, or on a server, depends on how you write the networking code on your client, or server.
enum Bool { True, False, FileNotFound };

#6 Anddos   Members   -  Reputation: 485

Like
0Likes
Like

Posted 30 December 2012 - 01:25 PM

i dont know what you mean by how i write my client and server, how should they be coded?


:)




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS