Can I socket server over the internet?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shockna1
    New Member
    • Apr 2010
    • 30

    Can I socket server over the internet?

    Im trying to maket a program for sending files and other stuf over the internet to my friend. My problem is I cant get it to work over the internet it only works when we are on the same network. Is there a way to send stuf over the internet insted of the network? Am I just mising something or is this imposible. This is what ive ben using for server:

    TcpListener SServer = new TcpListener(800 0);
    TcpClient SClient = default(TcpClie nt);
    SServer.Start() ;
    SClient = SServer.AcceptT cpClient();
    NetworkStream NetStream = SClient.GetStre am();
    ..........
    blablabla you get the point

    And this is what ive ben using for the client:

    TcpClient SClient = new TcpClient();
    SClient.Connect ("my ip address heer", 8000);
    NetworkStream netStream = SClient.GetStre am();
    .............
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    Does your friend really have a unique fixed IP address for his computer?
    Are you sending to the IP address of his router, which in turn is forwarding to the IP address of the PC?

    Comment

    • shockna1
      New Member
      • Apr 2010
      • 30

      #3
      Originally posted by tlhintoq
      Does your friend really have a unique fixed IP address for his computer?
      Are you sending to the IP address of his router, which in turn is forwarding to the IP address of the PC?
      We are both on a router if thats what you meen not the same one thow. And Im gusing your gonting to say I need to say I need to port forword or something like that but I tried that and it didnt work so Im guesing I screwed up.

      Comment

      • tlhintoq
        Recognized Expert Specialist
        • Mar 2008
        • 3532

        #4
        If your computer shows an IP address of: 192.168.0.150
        And at your friend's house his IP of: 192.168.0.10
        Those addresses are not visible to the rest of the world.
        You know that, right?

        If you are trying to create a TCP connection between two IP addresses, you have to have addresses that are unique in the entire internet and are visible to the world. Like a company web server. Dodge.com pays for a unique IP address, that is mapped to the human-friendly address of "dodge.com"

        If you aren't paying for a unique IP address, then you don't have one. Your ISP issues your router whatever address is free at the time. Your router issues different addresses to the computers on your network.

        Your router: 227.1.2.3.4
        Your computer behind that router: 192.168.0.1
        Another computer at your house: 192.168.0.2

        Friend router: 123.8.6.7
        Friend's computer: 192.168.0.1
        Another computer: 192.168.0.1

        Notice that both you and your friend can have computers with the same IP address, because they are behind the router which has a unique address.

        But remember, that unique address at the router is on loan. Tomorrow it might be a different IP address.

        Comment

        • shockna1
          New Member
          • Apr 2010
          • 30

          #5
          Originally posted by tlhintoq
          If your computer shows an IP address of: 192.168.0.150
          And at your friend's house his IP of: 192.168.0.10
          Those addresses are not visible to the rest of the world.
          You know that, right?

          If you are trying to create a TCP connection between two IP addresses, you have to have addresses that are unique in the entire internet and are visible to the world. Like a company web server. Dodge.com pays for a unique IP address, that is mapped to the human-friendly address of "dodge.com"

          If you aren't paying for a unique IP address, then you don't have one. Your ISP issues your router whatever address is free at the time. Your router issues different addresses to the computers on your network.

          Your router: 227.1.2.3.4
          Your computer behind that router: 192.168.0.1
          Another computer at your house: 192.168.0.2

          Friend router: 123.8.6.7
          Friend's computer: 192.168.0.1
          Another computer: 192.168.0.1

          Notice that both you and your friend can have computers with the same IP address, because they are behind the router which has a unique address.

          But remember, that unique address at the router is on loan. Tomorrow it might be a different IP address.
          So your saying it wont work unless I pay for a unique ip address?

          Comment

          • tlhintoq
            Recognized Expert Specialist
            • Mar 2008
            • 3532

            #6
            More or less, but what I'm really saying is you should probably research the technology you are trying to make use of, before investing a lot of time. If you want to develop applications that use IP communication you will save yourself a lot of time and heartache if you first understand how I.P. communication and addressing work.

            Direct PC to PC communication over the internet is not trivial. Do you notice that instant messaging services require servers to act as an intermediary? Do you see many I.M. programs that would let you and your friend chat *without* going through their service - like Yahoo?

            Right now, you are trying to develop a better television, without understanding how tv signals are broadcast.

            There are so many file sharing systems out there. It might just be easier to create a LogMeIn or GoToMyPC account that you both share and accesses both of your computers. Then you can remotely see/use each other's computers and drag/drop files to each other.

            Or just use Yahoo's file transfer option.
            Or an iDisk account.
            Or one of the many other file sharing sites.

            Comment

            • shockna1
              New Member
              • Apr 2010
              • 30

              #7
              Do I need an external static ip to host a web server or whatever?

              Comment

              Working...