Server with UDP and TCP

P

Pedro Pinto

Hi there!

I have a doubt that maybe someone can help me.

I have to create a server program that runs sincronized with other
servers using TCP. The issue here is, the clients contacting the
servers use UDP. That means that the servers have to listen to UDP and
TCP sockets and the same time. TCP for requests from other servers, UDP
for requests from clients. How can this be done? When i run the TCP
accept comand the system blocks and doesn't listen to the UDP port. The
same issue occurs if i use the UDP recvfrom comand. How can i have both
connections open at the same time?

Regards

Pedro Pinto
 
J

james of tucson

Pedro said:
When i run the TCP
accept comand the system blocks and doesn't listen to the UDP port.

You've entered into a world where you need nonblocking/asynchronous
socket IO.

Take your question to one of the network programming newsgroups where
you will receive help. Here you will only be told that this is not a
standard C programming question.
 
M

mark_bluemel

Pedro said:
Hi there!

I have a doubt that maybe someone can help me.

I have to create a server program that runs sincronized with other
servers using TCP. The issue here is, the clients contacting the
servers use UDP. That means that the servers have to listen to UDP and
TCP sockets and the same time. TCP for requests from other servers, UDP
for requests from clients. How can this be done? When i run the TCP
accept comand the system blocks and doesn't listen to the UDP port. The
same issue occurs if i use the UDP recvfrom comand. How can i have both
connections open at the same time?

As already mentioned, you probably should go to a networking group to
discuss this, as it's not actually about the C programming language.

This is standard stuff, but not standard C stuff.

<OT>If you are on Unix, I _strongly_ recommend getting copies of the W
Richard Stevens "Unix Network Programming" books which would cover the
necessary ground and are excellent</OT>
 
M

Mark McIntyre

Hi there!

I have a doubt that maybe someone can help me.

For what its worth, this English phrase means "I do not think that
anyone can help me".
You probably meant that you had a question that you hope someone can
help you with.
I have to create a server program that runs sincronized with other
servers using TCP. The issue here is, the clients contacting the
servers use UDP.

Unfortunately this is offtopic in CLC. You should ask again in
comp.unix.programmer, as sockets are topical there.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
D

Dave Thompson

You've entered into a world where you need nonblocking/asynchronous
socket IO.
Or select or poll or a system-dependent variant, see
comp.unix.programmer or somewhere like comp.os.$whatever

Or multithreading as already noted, comp.programming.threads

Or even multiple processes which share or exchange data as needed,
which might even be ontopic here, although probably not.
Take your question to one of the network programming newsgroups where
you will receive help. Here you will only be told that this is not a
standard C programming question.

Indeed. See above.

- David.Thompson1 at worldnet.att.net
 

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

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top