I have one project just like LanChating, now i want to upgrade it to internet & i don't know how to using socket-internet
Im use it:getaddrinfo, socket, connect, bind, listen, send

What's your problem behind this subject ?
If you are familiar with sockets you connect via Lan with ip address and port number. The same technique you can use for the world wide web (internet), just by use of public ip addresses. So where you think should be a problem ?

27 Apr 2012, 17:08

r22

Joined: 27 Dec 2004
Posts: 805

r22

You posted this on the Windows forum so your using Winsock API.

TCP/IP will work the same as on your LAN but you will need to configure your router and firewall to allow INCOMING connections to your server IP:PORT (this is where you have the listen socket). Also, when binding your listen socket be sure to bind it to 0.0.0.0 IP not an internal/subnet IP.

27 Apr 2012, 18:03

MinhHung

Joined: 10 Sep 2010
Posts: 51
Location: Viet Nam

MinhHung

http://canyouseeme.org/ to get my IP
and i listen at port 1234
orther computer try to connect to my IP with same port
->could not connect ???
but with Lan it establish

28 Apr 2012, 02:53

JohnFound

Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria

JohnFound

Can you run other server applications on your computer? Bittorent clients or Skype for example? Are you behind a firewall or router?
It is probably because of your ISP.

28 Apr 2012, 06:48

Picnic

Joined: 05 May 2007
Posts: 1288
Location: behind the arc

Picnic

Notice that modern bittorent clients like μtorrent exploit router's built in UPnP (Universal Plug 'n Play) which allows automatic forwarding of ports.

Check your firewall settings.
What is your public ip address of your chat server and what port is it running ?

28 Apr 2012, 09:37

typedef

Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000

typedef

Local Network
[x] You can connect to all computers by just opening Windows Firewall.

Internet & Local
[x]Open port in Windows Firewall and your router's firewall. Now in case you have a dynamic IP, then go to http://no-ip.com and setup a free DNS hosting account and download their client software.

Do not try to connect yourself to your public IP address as that creates a loopback.

Only do this if your computer will be serving calls. Otherwise you can use a central server that'll handle calls.

28 Apr 2012, 12:16

MinhHung

Joined: 10 Sep 2010
Posts: 51
Location: Viet Nam

MinhHung

Thanks!!! )

01 May 2012, 11:35

F45mH4ck3r

Joined: 04 Jan 2011
Posts: 1

F45mH4ck3r

@MinhHung

The Internet consists of computers around the world linked together, therefore known as a Wide Area Network (WAN).

Each Server-Socket is bound to a local Network Interface where it listens for incoming requests.
Create a Server-Socket and bind him. To a Local Network Interface
Replied the socket in Listening-Mode.
If the Server-Socket accepts an incoming connection, it creates a new Socket, which is then used to communicate with the client and listen again on the server socket for incoming requests.
With UDP, the Server-Socket is not bound to an interface.

A Client-Socket is not bound, and can be used freely.
The Port is important only above the IPv4/IPv6 Protocol.

On Windows you can use the command netstat -anov to check if the Port and the Protocol is already in use by another application.
If the Port and the Protocol (TCP/UDP) is already in use by another Program, then you have to look for a free port.
These ports are usually already covered:
Port: 20.21 → FTP
Port: 25 → SMTP
Port: 53 → DNS
Port: 80 → HTTP (Web-Server)
Port: 110 POP3 →
Port: 137,139,445 → Windows Network.

It is important that the router incoming connections from the WAN to the local IP address of the server is released.

Example:
WAN: 77.22.33.44 TCP/UDP → LAN: 192.168.1.20 TCP/UDP

I can post a Sample-Code if you want !?

Sorry for my bad English, I'm German.

08 Mar 2013, 04:55

winx

Joined: 20 Mar 2013
Posts: 1

winx

We have the same idea in project and I've tried the solution by Checking my firewall settings..it really works!

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum