Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi there, I'm working with socket programming to let an embedded linux
system (TS-7200 board) deal with a windows-based client. After calling
 "socket", "bind" and "listen" I need to call "accept" to establish
the connection between client and server. How can I accept a
connection in non blocking mode? With fnctl I can set this mode for my
own socket file descriptor and it works with the listen command, but
how can I let my program work unblocked? I need to make differnt
things while waiting for data to be ready to read on the ethernet. If
data can come in asyncronously from different sources (ethernet,
rs-485, rs-232) how can I determine which one to choose and when?

Re: tcp/ip
Quoted text here. Click to load it

Some of many options:

You can use select() to wait on one of several resources.

You can create multiple processes by using fork() and communicate
between them e.g. with system V message queues or sockets.

You can create multiple threads using the posix thread library. Here all
threads can share the data memory, so that you don't need to transfer
data from one to another. Posix threads are especially interesting when
using Linux 2.6.x as the thread performance has been improved greatly
(with 2.4 threads were justs processes that share memory pages).


Re: tcp/ip

Quoted text here. Click to load it

Use select on the listen socket and then accept.
Beej's famous guide shows this in detail: /

Best regards,

Bernhard Roessmann
Don't Fear The Penguins!

Site Timeline