In programs using TCP we usually have a separate client and server.
Is it possible to have a program using TCP connection to act both as
server and as client?
Please help.
Printable View
In programs using TCP we usually have a separate client and server.
Is it possible to have a program using TCP connection to act both as
server and as client?
Please help.
Yes, that is possible.
Thank you Salem .Can u tell me how please?. Is there any special functions to do it?.
I encounter the following problem of a graph.
A-------B---------C
where A,B,C are nodes where B must act as client to A but server to C.
Please help me as i am new to C & Socket programming.
Thanks in advance.
So in other words, A and C would normally communicate directly, but B is there to act as a proxy or a filter.
yes like a filter.Can one program(B) listen and connect on two different sockets?
Yes.
hi guys,
Can u please give me some idea about how to solve this with specific functions?
If you know what functions you need for either end of the communication, you probably would need the same functions for doing a "filter" or "proxy" server.
If you don't know/understand how to do that, then you probably need to read up a bit on "programming sockets".
--
Mats
All right.Thanks for the help guys.
wrt socket programming :
Local addressing format is used by sockets that are local to your hosts.
eg : lpr command uses local socket to communicate with spooling service.
It is possible to use TCP / IP for local communication, but not recommended ( less efficient )
To communicate betwn nodes : TCP / IP (AF_INET)
TO communicate with local sockets : Local addressing format ( AF_UNIX)
Following show communication betwn
A to B
betwn B and B
B to C
A ---- (IPv4) ---- B ----- (local addressing format) -----B ----- (IPv4) ----- C
HTH
Thanks,
Rohit Kalsarpe
I would apologize for the tards on this board, but if I did that Id never have time to post anything useful.
Since you didnt mention information that I woudl need to provide a helpful answer, like what OS (windows or linux) you are using I will go ahead and assume you are programmign for windows.
The API function you want to use are the following
WSAStartup()
socket()
bind()
connect()
listen()
send()
recv()
WSACleanup()
those will let you make a basic functional tcp connection, from there you can look into the more complex issues fo blocking versus non-blocking, protocol types etc.