flat assembler
Message board for the users of flat assembler.

Index > Windows > How to socket connect to internet ???

Author
Thread Post new topic Reply to topic
MinhHung



Joined: 10 Sep 2010
Posts: 51
Location: Viet Nam
MinhHung
Hello!!!

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

_________________
sorry for my english
Post 27 Apr 2012, 14:16
View user's profile Send private message Yahoo Messenger Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria
JohnFound
Hm, I don't have so good network programming skills, but IMHO, there is no difference between LAN and Internet socket connections.
Post 27 Apr 2012, 14:19
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
JohnFound wrote:
Hm, I don't have so good network programming skills, but IMHO, there is no difference between LAN and Internet socket connections.
Broadcast messages vs. client/server architecture, and possibly IPX vs. TCP/IP.

_________________
Image - carpe noctem
Post 27 Apr 2012, 16:01
View user's profile Send private message Visit poster's website Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 518
Location: Munich
shutdownall
MinhHung wrote:
Hello!!!

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 ?
Post 27 Apr 2012, 17:08
View user's profile Send private message Send e-mail Reply with quote
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.
Post 27 Apr 2012, 18:03
View user's profile Send private message AIM Address Yahoo Messenger Reply with quote
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
Post 28 Apr 2012, 02:53
View user's profile Send private message Yahoo Messenger Reply with quote
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.
Post 28 Apr 2012, 06:48
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
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.
Post 28 Apr 2012, 08:12
View user's profile Send private message Reply with quote
MinhHung



Joined: 10 Sep 2010
Posts: 51
Location: Viet Nam
MinhHung
Sorry every body
i write it in C using winsock
http://www.mediafire.com/?4avc0s4s6d2be3j
I could not connect it via internet ???
Post 28 Apr 2012, 09:10
View user's profile Send private message Yahoo Messenger Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 518
Location: Munich
shutdownall
MinhHung wrote:
Sorry every body
i write it in C using winsock
http://www.mediafire.com/?4avc0s4s6d2be3j
I could not connect it via internet ???


Check your firewall settings.
What is your public ip address of your chat server and what port is it running ?
Post 28 Apr 2012, 09:37
View user's profile Send private message Send e-mail Reply with quote
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.

After that, go to http://yougetsignal.com and check your port if is it forwarded properly.

You'll know if you did it right.

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.
Post 28 Apr 2012, 12:16
View user's profile Send private message Reply with quote
MinhHung



Joined: 10 Sep 2010
Posts: 51
Location: Viet Nam
MinhHung
Thanks!!! Smile)
Post 01 May 2012, 11:35
View user's profile Send private message Yahoo Messenger Reply with quote
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. Wink
Post 08 Mar 2013, 04:55
View user's profile Send private message Reply with quote
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!
Post 21 Mar 2013, 01:40
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.