Thread: connecting to a computer inside a LAN

  1. #1
    Registered User
    Join Date
    Jan 2005
    Location
    Estonia
    Posts
    131

    connecting to a computer inside a LAN

    Hello.

    I was wondering:
    how is it possible to connect to a computer inside a LAN.
    My friend and I are in the same LAN and when we go to a website which tells us our IPs, we both get the same ip: 213.35.228.190.

    So if we both set up our own servers, then how can a client recognize that 1 server is mine and the other is his. My guess would be that the use of MAC numbers will help to make a difference between me and him, but how is it exactly?

    Can anyone give me a sample code on how to connect to LAN computer. (when the outside client can't actually connect via a simple IP).

  2. #2
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    You connect to the Internet behind a firewall. This is a single point of entry to the network. Your IP address is more along the lines of 192.168.x.x or some other private network.

  3. #3
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    You will use ports, and your router/computer which is directly connected to the net and serves out the internet, the port will be forwarded to the IP which you set it up to connect to. So you have to set that all up yourself.

    For network programming look up sockets, if you are on windows, Winsock is what you want.

    *Note, if you can't access the router/computer that is directly connected to the internet. Then you are as they say, SoL.

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    If the client is outside the LAN (on the internet), you will need to use "port forwarding" (do a search if you need help) as suggested by Wraithan.

    If the client is also on the same LAN, you can use the local IP address. On Windows, this can be obtained by typing "ipconfig" on the command line.

  5. #5
    Registered User
    Join Date
    Jan 2005
    Location
    Estonia
    Posts
    131
    okay i read about it, and i understand how it works(at least i think so).

    Let's say I know that a computer inside a lan has a server set up on port 7777.
    i am outside the LAN and need to connect to that port. But how can I do it? How can the router know that I want to connect to a specific computer with port 7777?

  6. #6
    Registered User
    Join Date
    Jan 2005
    Location
    Estonia
    Posts
    131
    i mean, how do i know which prot in the router will be redirected to which port in my pc. I can't access the router itself to edit the table of redirections, is there another way?

    How can I see the ports in the router that are forwarded to me.

  7. #7
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    If you can't access the router then no ports at all are forwarded. That's something you must do manually, and that's how you know. To the outside, it really looks as if the router itself was providing the service.

    There is no router-transparent way of doing this stuff. Not until IPv6 is widely adopted and you can get 10 IPs cheap.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Computer Hacked over LAN
    By Puppet Master in forum Tech Board
    Replies: 11
    Last Post: 06-17-2008, 02:48 PM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. Regarding Undergraduate Computer Majors
    By UnregdRegd in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 10-04-2003, 11:55 AM
  4. Problems shutting off computer
    By frenchfry164 in forum Tech Board
    Replies: 9
    Last Post: 04-22-2003, 06:19 PM
  5. Which distro should I run on my old computer?
    By joshdick in forum Tech Board
    Replies: 5
    Last Post: 04-09-2003, 01:37 AM