OT: sockets

G

Gernot Frisch

Hi,

sorry, I didn't know where else to go...

I want to make a client/server program. The server should wait for
incoming messages, but if no messages are present, the recvfrom
function should return immediately. Any ideas? Should I start a worker
thread that stores messages received on a stack?

I'm new to sockets, can you point me to a good source?

Thank you,
 
S

Sivert Berg

Gernot Frisch said:
Hi,

sorry, I didn't know where else to go...

I want to make a client/server program. The server should wait for
incoming messages, but if no messages are present, the recvfrom
function should return immediately. Any ideas? Should I start a worker
thread that stores messages received on a stack?

I'm new to sockets, can you point me to a good source?

Thank you,

This is a bit platfrom dependent, but I think that select() is used in both
Winsock and BSD so do this:
1) Make a non-blocking socket.
2) Run the RecvFrom() command.
3) Run the select() command to check if it is anything to read. Did
something similar with connect(). Should work. And next time post in a
group that is dedicated to the OS or whatever your runing.

Sivert Berg
 
L

Lothar Werzinger

Gernot said:
Hi,

sorry, I didn't know where else to go...

I want to make a client/server program. The server should wait for
incoming messages, but if no messages are present, the recvfrom
function should return immediately. Any ideas? Should I start a worker
thread that stores messages received on a stack?

I'm new to sockets, can you point me to a good source?

Try using the ACE framework (http://www.cs.wustl.edu/~schmidt/ACE.html).
It's perfect for networked programming.

lothar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top