client server and exchange of messages over internet

Discussion in 'C' started by ekansh, May 25, 2009.

  1. ekansh

    ekansh New Member

    Joined:
    May 25, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    hello people,
    I am very new to this forum and its my firs post

    I want to create a simple client server c++ application for exchange of messages over internet
    I have written a client server using TCP,sockets and is working perfectly on Internet . But the thing is I manually have to open the router ports... that is I have to configure router my self.
    Could you please guide me what should I look for so that my code can work for intenret without manually opening ports.
    We use several messengers, we nerver have to manually open the port so how they operate.
    The client server code is very simple and basic.
    I heard about UPnP and hole punching.
    Reverse port tunneling. Would it help.??

    And I am developing it on Linux.
    Please I will appreciate your help and if you can give me a sample of code. I am a novice in network programing
    Regards
     
  2. ekansh

    ekansh New Member

    Joined:
    May 25, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    And i dont know where to post threads .. pls u can give me idea of that also..
    sorry :)
     
  3. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    >But the thing is I manually have to open the router ports

    Yeah, that's the point of them.

    > Could you please guide me what should I look for so that my code can work for intenret without manually opening ports.

    Not possible sorry. The whole point of firewalls is that they block unwanted traffic, and that's why they allow you to open ports; this lets you define what is wanted.

    The only thing you can do is to change your code so that it works over ports that you can expect to be open. For example port 80 (http) is often open so if you code up your packets to work over HTML then you can fairly reliably get through most firewalls.
     
  4. ekansh

    ekansh New Member

    Joined:
    May 25, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Thanks a lot for your reply.. I am using sockets and i tried using port 80 and other well known ports. The error i got is can not bind socket..(some thing like that)
    so i guess i cant use port already in use..
    There are some P2P clients then how do they communicate with peers. they I guess don't use these well known ports.. Or is it so. that P2P instead of the name Peer to peer still use servers
     
  5. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
  6. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    P2P programs need you to setup port forwarding in the router.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice