C Board  

Go Back   C Board > General Programming Boards > Networking/Device Communication

Reply
 
LinkBack Thread Tools Display Modes
Old 10-24-2006, 02:16 PM   #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).
hardi is offline   Reply With Quote
Old 10-24-2006, 02:31 PM   #2
Jaxom's & Imriel's Dad
 
Kennedy's Avatar
 
Join Date: Aug 2006
Location: Alabama
Posts: 871
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.
Kennedy is offline   Reply With Quote
Old 10-24-2006, 03:31 PM   #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.
__________________
Enlighten Yourself

I'm back!
Wraithan is offline   Reply With Quote
Old 10-24-2006, 10:29 PM   #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.
anonytmouse is offline   Reply With Quote
Old 10-25-2006, 01:53 PM   #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?
hardi is offline   Reply With Quote
Old 10-25-2006, 02:17 PM   #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.
hardi is offline   Reply With Quote
Old 10-25-2006, 04:43 PM   #7
Cat without Hat
 
CornedBee's Avatar
 
Join Date: Apr 2003
Posts: 8,492
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
CornedBee is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 12:39 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22