LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   socket programming (https://www.linuxquestions.org/questions/linux-networking-3/socket-programming-936011/)

harishbec2006 03-23-2012 04:21 AM

socket programming
 
i have to write a simple proxy program like A<->B<->C<->...where a and c are my main client and server process and b sits in between them....my job is to create a proxy server(B) which can send and receive very simple data like char string to and from A to C.i have completed my half of communication i.e. A<->B.now how can i communicate B<->C.both b and c are tcp servers.please help me.my language is C on fedora 15.

acid_kewpie 03-23-2012 04:24 AM

Per the LQ Rules, please do not post homework assignments verbatim. We're happy to assist if you have specific questions or have hit a stumbling point, however. Let us know what you've already tried and what references you have used (including class notes, books, and Google searches) and we'll do our best to help. Also, keep in mind that your instructor might also be an LQ member.

lqman 03-27-2012 03:05 AM

Quote:

Originally Posted by harishbec2006 (Post 4634272)
i have to write a simple proxy program like A<->B<->C<->...where a and c are my main client and server process and b sits in between them....my job is to create a proxy server(B) which can send and receive very simple data like char string to and from A to C.i have completed my half of communication i.e. A<->B.now how can i communicate B<->C.both b and c are tcp servers.please help me.my language is C on fedora 15.


In socket programming, whenever you create TCP connection it always has source ip address & port and destination ip address & port.
In B, you can use source / destination ip & port to send data from A to C and its reply from C to A.

Hint :
Create TCP connection from A to B and from B to C and keep it alive.
Then your socket program in B waiting data from A & C. If data comes from A, send it to C then wait for data reply. When data reply appear/comes C from send it to A.


Read more about socket programming. :newbie:


All times are GMT -5. The time now is 03:37 PM.