On Windows 11, I am never connected via wifi to the internet, but via wire.
I wanted to test the wifi connection, but only locally, without any internet connection.
I have wifi enabled, as well as a wireless mobile hotspot.
https://youtu.be/rQq87isfLHo
Here is a server program and another client, which will need to be compiled separately and to authorize firewall.
For the client program, you will need to enter the correct IP.
At home I get:
Connection to local network* 2 192.168.137.1 1
That is : 192.168.137.1 for OpenConnection in client
Launch the server program.
Launch the client program.
***WAITLEFTMOUSE***
Click on the client window to start the connection.
The server detects the connection very quickly.
The client sends the "OPENCONNECTION FROM CLIENT" message to the server
The client displays:
"(ONCONNECT FROM SERVER)" 8 seconds later
"(ACK FROM SERVER)" 11 seconds later
When I click on the red square the client sends the "XOR" message,
the server will display it 10 seconds later.
When I click on the blue square the server sends the "CLICK" message,
the client will display it 10 seconds later.
Even if I deactivate the firewall, I get the same results.
Do you have the same results as me, with such modern equipment
Code: Select all
@DISPLAY {title="Server"}
SetFont(#SANS, 16)
SetFontStyle(#ANTIALIAS)
Function p_MyFunc(msg)
Switch msg.action
Case "OnMouseUp":
SendData(cliid,"CLIC")
EndSwitch
EndFunction
Box(200, 200, 100, 100, #BLUE)
evtmatch = {OnMouseUp = p_MyFunc}
MakeButton(1,#SIMPLEBUTTON, 200, 200, 100, 100, evtmatch)
NPrint("+1+")
t = GetLocalInterfaces()
For Local k = 0 To ListItems(t) - 1
NPrint(t[k].Name, t[k].Address, t[k].Protocol)
DebugPrint(t[k].Name, t[k].Address, t[k].Protocol)
Next
NPrint("+1+")
CreateServer(1,2550)
NPrint(GetLocalPort(1,#NETWORKSERVER))
NPrint("+2+")
Function p_ConnectFunc(msg)
Switch(msg.action)
Case "OnConnect":
NPrint("Connected client id : ", GetLocalIP(msg.clientid))
NPrint("id : ",msg.clientid)
SendData(msg.clientid,"(ONCONNECT FROM SERVER)")
cliid=msg.clientid
NPrint(cliid)
Case "OnReceiveData":
data$ = ReceiveData(cliid, #RECEIVELINE)
NPrint(cliid,data$,msg.id)
SendData(msg.id,"(ACK FROM SERVER)")
EndSwitch
EndFunction
InstallEventHandler({OnConnect = p_ConnectFunc, onreceivedata=p_connectfunc})
Repeat
CheckEvent
Wait(1)
Forever
Code: Select all
@DISPLAY {title="Client"}
SetFont(#SANS, 24)
SetFontStyle(#ANTIALIAS)
Function p_MyFunc(msg)
Switch msg.action
Case "OnMouseUp":
SendData(1, "XOR")
EndSwitch
EndFunction
Box(200, 200, 100, 100, #RED)
evtmatch = {OnMouseUp = p_MyFunc}
MakeButton(1, #SIMPLEBUTTON, 200, 200, 100, 100, evtmatch)
NPrint("+1+")
t = GetLocalInterfaces()
For Local k = 0 To ListItems(t) - 1
NPrint(t[k].Name, t[k].Address, t[k].Protocol)
DebugPrint(t[k].Name, t[k].Address, t[k].Protocol)
Next
NPrint("+1+")
CreateServer(1,2550)
NPrint(GetLocalPort(1,#NETWORKSERVER))
NPrint("+2+")
NPrint("*** WAITLEFTMOUSE ***")
WaitLeftMouse
OpenConnection(1,"192.168.137.1", 2550)
NPrint("+OPENCONNECTION+")
SendData(1,"OPENCONNECTION FROM CLIENT")
Function p_ConnectFunc(msg)
Switch(msg.action)
Case "OnReceiveData":
data$ = ReceiveData(msg.id, #RECEIVELINE)
NPrint(data$)
EndSwitch
EndFunction
InstallEventHandler({OnReceiveData = p_ConnectFunc})
Repeat
CheckEvent
;Wait(1)
Forever
CloseConnection(1)