Jump to content
Sign in to follow this  

Serverless UDP connections

Recommended Posts


well for the last 3 months on and off i have been looking for a UDP example script that would be usefull to learn from.. i know how to make a TCP multiclient... though that needs a server.. what i would like is (for my current Chess PVP game project) is:

*any UDP examples on how to do it without a server (person starts up game... waits and another person connects and they play..)

*possibly some directions in where to learn from

*is it even possible for a UDP serverliess PvP game..

i HAVE seen a few UDP examples around here... but i have no idea how they function.. so please any help? :)

Share this post

Link to post
Share on other sites

Opt("GUIOnEventMode" , 1)
$d=UDPOpen("" , 8080,1)
$input=GUICtrlCreateInput("" , 5 ,210,350,20)
$b=GUICtrlCreateButton("Send" , 355,210,50,20,$BS_DEFPUSHBUTTON)
GUICtrlSetOnEvent(-1 , "_send")
While 1
    If IsArray($recv) Then _GUICtrlEdit_AppendText($edit,StringFormat("[%s:%s] > %s\n" , $recv[1],$recv[2],$recv[0]))
Func quit()
Func _send()

here's a simple example :) you can even test in on your local machine. BUT! because it uses broadcasting you cannot listen on the same port twice so if you run more than one instances of the script only the first one will recv the data but all of them can send :)

P.S.: you need the latest beta

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.