LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-23-2012, 04:21 AM   #1
harishbec2006
LQ Newbie
 
Registered: Aug 2009
Location: india
Distribution: fedora 10
Posts: 1

Rep: Reputation: 0
Question 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.
 
Old 03-23-2012, 04:24 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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.
 
Old 03-27-2012, 03:05 AM   #3
lqman
LQ Newbie
 
Registered: Nov 2010
Location: Surabaya, Indonesia
Distribution: debian, ubuntu, FreeBSD, Solaris
Posts: 17

Rep: Reputation: 3
Quote:
Originally Posted by harishbec2006 View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Lab 5: Socket Programming and Pthreads Programming teesha Linux - Newbie 2 02-27-2012 12:25 AM
Socket Programming jawadhashmi Programming 4 05-24-2005 03:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration