S
ssantamariagarcia
I am trying to program a server in C for UNIX to get a kind of "bridge"
between the clients of a port A and the clients of a port B.
For that, I create 2 processes: one that listen the requests of port A
clients and another for the Port B ones.
In each process, when a connetion service is required, after accepting
, the value of the socket generated is added to a set of sockets. This
set keeps on listening on each socket for new messages to be read.
the question is that both processes get the same socket values, I
mean, the first client asking on port A get the same socket number that
the first one on port B. So I can not refer to a client in a unique way
, because there will be 2 clients with the same socket number .
I am using fork(), and in each process created, I use a method in
charge of creating the set of sockets and waiting for some event. I
suspect that the use of fork() is not right in this situation.........
In other words: If there is anybody who could know how to program a
server which is going to receive messages on 2 diferents ports and it
has to carry them from one port to another ( both ways), please, please
help me.
Thanks a lot !
(Sorry about my english)
between the clients of a port A and the clients of a port B.
For that, I create 2 processes: one that listen the requests of port A
clients and another for the Port B ones.
In each process, when a connetion service is required, after accepting
, the value of the socket generated is added to a set of sockets. This
set keeps on listening on each socket for new messages to be read.
the question is that both processes get the same socket values, I
mean, the first client asking on port A get the same socket number that
the first one on port B. So I can not refer to a client in a unique way
, because there will be 2 clients with the same socket number .
I am using fork(), and in each process created, I use a method in
charge of creating the set of sockets and waiting for some event. I
suspect that the use of fork() is not right in this situation.........
In other words: If there is anybody who could know how to program a
server which is going to receive messages on 2 diferents ports and it
has to carry them from one port to another ( both ways), please, please
help me.
Thanks a lot !
(Sorry about my english)