Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / Udp for internet? local?

Author
Message
stigmat
2
Years of Service
User Offline
Joined: 1st Apr 2019
Location:
Posted: 22nd Aug 2021 11:54
Hi all,
im trying UDP for send message app to app with internet, it seem to work well when im on same local network with ipv6, but not more when using internet.
I have see on the appgamekit help this :

integer CreateUDPListener( listenerID, ip, port )

listenerID - The ID to use to reference this listener in future.
ip - The local IP address to bind to.
port - The local port to bind to.

"Local", then mean this command work only in local?

i can make work easy the way to send and receive message with HostNetwork , JoinNetwork ...
but udp listener seem less options i dont need

Udp command work only in local?WHat is the best way , faster, for send and receive message command?

Thank and sorry for my english ...
PartTimeCoder
AGK Tool Maker
6
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 22nd Aug 2021 13:07 Edited at: 22nd Aug 2021 13:10
Are you allowed (router settings) to use the port?

99% of the time when network stuff fails is default ISP settings in your hub or router blocking incoming connections on port xyz, if it works local and not global then this would be my first port of call, no pun intended!
Open Source plugins
Cl - DnD Plugin
hosch
Developer
User Offline
Joined: 25th May 2021
Location:
Posted: 22nd Aug 2021 13:19 Edited at: 22nd Aug 2021 13:21
It depends on what you are trying to send.

UDP is fast, yes, but you have no way to actually verify, if the message has been received like with TCP. If you only send it once, and taking packet loss into account, there is a good chance that your message has not been received at all, or at the wrong order etc. Local network is no big challenge for UDP, but sending over the internet is.

You'd have to implement such a system yourself with tics or timestamps. What are you trying to do?
stigmat
2
Years of Service
User Offline
Joined: 1st Apr 2019
Location:
Posted: 22nd Aug 2021 15:01
Thank for your answer, for moment i just try send a short string with udp, and yes i have learn on internet udp is good for short send, when error cant br a problem and tcp for send when must receive without error.
Maybe the problem is for try i use the internet adsl connection , and my gsm connection, i just have see my gsm connection dont have ipv6 , im going try better with ipv4 , thank for your help

so you agree udp is ok for internet.
I want send data with gsm phone to computer to

i return in some try, thank
hosch
Developer
User Offline
Joined: 25th May 2021
Location:
Posted: 22nd Aug 2021 15:19 Edited at: 22nd Aug 2021 15:24
Yes, I agree, you can use UDP over the internet. Local IP in this case would refer to the IP of the PC you are trying to send to. Since there can be many PCs behind a router, you need to know this address.

Since you can't always know these addresses, that's what master servers in game development typically are for. Client 1 connects and tells the master server his IP. Client 2 connects and tells the master server his IP. The master server passes the IPs to the players so they can connect to each other.
stigmat
2
Years of Service
User Offline
Joined: 1st Apr 2019
Location:
Posted: 22nd Aug 2021 17:28
yes i understand that, i have started before to make a littlemultiplayer gamer with the commands host join ... as work well and for join a game the computer sever was send is ip in a sql database (with a user name) for other player can connect.

i remember the communication as work well pc to pc, but dont hav try pc (windows) to android .
And now its what i want, windows to android .
what kind of transfer use " sendnetworkmessage" ? when use hostnetwork , UPD ? TCP?
Really thank for your help and ur fast answers
hosch
Developer
User Offline
Joined: 25th May 2021
Location:
Posted: 22nd Aug 2021 20:52 Edited at: 22nd Aug 2021 20:52
I have not found any info on this in the documentation, but with netstat -a -n -o in the Windows cmd / command prompt, a connection set up with HostNetwork shows up under the TCP protocol. Therefore, I'm fairly (but not 100% due to the lack of official sources) certain that it uses TCP.
Raven
16
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 23rd Aug 2021 02:59
Quote: ""Local", then mean this command work only in local?"


Ports are always Local., as they are an "Endpoint"

A good way to look at it is, you know how when you phone a business; each person / department doesn't have a unique phone number., instead they have an Extension.
Well that's basically what a Port is.

So say you call IP 168.192.0.1:80... this is basically saying "I want to connect to this Device, and I want to talk to the Internet"., if we used 168.192.0.1:443 you're basically saying you want a Secure Line to the Internet.

Now in general terms there 0 - 65535 Ports, but Ports up to 1024 are "Pre-Registered"; meaning they are either assigned to specific services OR are reserved for future "Common" Services.
This means in reality we can only use 1025 - 65535 for whatever we want, such-as Game Services.

Now for UDP to work over a Network you must supply an IP to an external machine and a valid (open) Port
I'd recommend Port 4000 - 5000... and remember you DO want to use a Range., because you'll likely want to run Multiple Game Server Instances on a Single Server.
As a further note MOST Internet Services Provides do not yet support or provide IPv6; where-as this has been commonly supported over LAN / WiFi for the past 15 years.

So it's highly recommended to use IPv4 instead.



Now beyond this UDP and TCP (Sockets) work slightly differently to each other.
TCP will create a Direct Connection., with Network Messages handled with Authentication and in FIFO Order.
UDP will create an Open Connection., with Network Messages handled on a send-and-forget in the order YOU send them in... on top of this there are no checks to make sure they're received.

Typically speaking UDP is great for Low-Latency Scenarios., as you're just sending the Network Messages whenever you want and hoping someone is listening for them.
TCP on the other hand is great for Guaranteed Data, like say sending a File.

Now you can use both for Game Servers., and typically you'll actually use a Hybrid of Both; where Real-Time Data (Player Position, Are They Doing an Action, etc.) is via UDP; while Game Chat, Inventory Access, etc. is handled via TCP.
stigmat
2
Years of Service
User Offline
Joined: 1st Apr 2019
Location:
Posted: 28th Aug 2021 01:46
Raven thank a lot, i take it!
And i just see UDP is limited size, im going make some try for use udp and tcp
stigmat
2
Years of Service
User Offline
Joined: 1st Apr 2019
Location:
Posted: 28th Aug 2021 16:27
Hi, my socket connection is working with local ! i try it with internet private ip next time
Then i can use easy use the SendSocketString and i receive it well .
But i dont understand, tcp so, send the packet and wait for the receiver send the receive answer or if no receive it resend.but the app is running,
so, if the connexion get slow, the loop spin, and the FlushSocket continue to send.Dont the app have to care?


In futur if i want try to send a file with tcp, like a image, if i understand i have to change it to base64 and send it byte per byte?
Maybe put all byte in array and send index after index?
Thank for your help and time

Login to post a reply

Server time is: 2021-10-21 04:00:38
Your offset time is: 2021-10-21 04:00:38