ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am porting at TCPIP program from windows to linux. In windows there are events like FD_ACCEPT, FD_READ, FD,WRITE and FD_CONNECT what is the equivalent ones to use in Linux. Any examples would be welcome.
There are functions like accept(), read(), write() etc. All have their manpages, for example 'man 2 accept' will show accept's manpage (with syntax, return values etc).
The list of all (if I make no mistake here) functions you need: socket, bind, listen, accept, read, write, close.
You sound like you're used ti using an event loop and WM_SOCKET messages. I don't know if you plan on doing GUI programming, and I don't know if the linux gui toolkits provide a similar functionality. However, what you do have availabe is the select() function. You can pass to it a number of socket descriptors, and a timeout, it returns when the time is up or one of the sockets is readable/writeable. You don't have any type of "connect" or "accept" though, just readable and writeable. You have to determine what's going on yourself. 'man 2 select' and I'd read this if you want a real understanding of what's going on, which you probably do: http://www.ecst.csuchico.edu/~beej/guide/net/html/
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.