Find the answer to your Linux question:
Results 1 to 7 of 7
Hello, I have written a Client - Server program in linux using socket programming... means between two pc's connected directly.. works fine.... but i want to connect a router in ...
  1. #1
    Just Joined!
    Join Date
    Nov 2007
    Posts
    27

    Client-server Proragmming, router connected in between

    Hello,

    I have written a Client - Server program in linux using socket programming...
    means between two pc's connected directly.. works fine....
    but i want to connect a router in between the two pcs, means pc1 is connected to LAN port of router and the other is connected to WAN port of router....how can i develop the code for establishing a connected between the pc1 and pc2, connected router in between them..


    thanks in advance....

    regards
    spymate....

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    There's nothing different you need to do on the server side.

    There's also nothing different you need to program on the client side. The only interesting item of information you need on the client side is the proper IP address for reaching the server.

    And that piece of information will come as you properly configure the router.

    Unfortunately, I have no information about properly configuring the router; I hope someone else jumps in with that. But I can tell you that the presence of a router will not make you need to change any of your application code.
    --
    Bill

    Old age and treachery will overcome youth and skill.

  3. #3
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by spymate View Post
    Hello,

    I have written a Client - Server program in linux using socket programming...
    means between two pc's connected directly.. works fine....
    but i want to connect a router in between the two pcs, means pc1 is connected to LAN port of router and the other is connected to WAN port of router....how can i develop the code for establishing a connected between the pc1 and pc2, connected router in between them..


    thanks in advance....

    regards
    spymate....
    It's completely irrelevant the number of nodes between the server and the client, unless you are doing some very very very low level stuff. If there's a problem, then its probably a configuration problem, and not a problem in your program.

  4. #4
    Just Joined!
    Join Date
    Nov 2007
    Posts
    27
    Thanks for the reply....

    The point is correct that there will not be much difference of the code with router and without router, if we develop the client server by directly connecting, we will give the ip address of the server in the client and vise-versa, but when connected through router, the router Lan will have one IP address and Router Wan will have one IP address, here i am unable to understand will IP address must be given in the client and the server...........
    can u plz help in solving the problem...

    thanks in advance...

    reguards,
    spymate

  5. #5
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Your question at this point isn't entirely clear to me. By the time you're done configuring a router, you should have at hand all IP addresses you need.

    Have you configured your router? What does your router's configuration look like?
    --
    Bill

    Old age and treachery will overcome youth and skill.

  6. #6
    Just Joined!
    Join Date
    Nov 2007
    Posts
    27
    As per my requirement i have 2 develop a client server application througha router in between them.i have configured the router, i have assigned the ip's for both the lan and the wan ports and the gateway also for the router.
    In the client side, normally the ip of the server is given in the client for the establishment of the connection.

    but if a router is connected, we will have 3 ips, server ip, router lan ip, router wan ip, and even the gateway of the router...

    i am facing the problem here, which ip must be mentioned in the client for the establishing the connection wit the server.

    can u plz help me ...

    thanks in advance

    reguards
    spymate

  7. #7
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    I've never configured a router, so I can't really tell the answer for sure. I'm hoping someone else can jump in here.

    But my guess is that you want the server ip, as before.
    if a router is connected, we will have 3 ips, server ip, router lan ip, router wan ip, and even the gateway of the router.
    Don't be afraid to experiment. You have four IP addresses there. You could have tried plugging each into your software (even the ridiculous choices could be tried, so you do all four), and probably have come up with an answer ... oh, two days ago or so. :)

    Of course, I could be wrong....
    --
    Bill

    Old age and treachery will overcome youth and skill.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...