I am having issues getting the server to acknowledge a telnet session. Are there more docs that explain how this is initiated and processed??
The HostNetwork works. I can connect to port 9100 but endless typing does nothing on the client side and the server never shows an established connection.
Oddly the server reports the loopback address as the IP for some reason when using GetDeviceIP() which I can however connect to via terminal on the same machine running the server.
Typing in telnet does nothing on the server side and when I close the server I get a connection refused so I know something is working.
This is what I get from the telnet session:
telnet 127.94.0.1 9100
Trying 127.94.0.1...
Connected to 127.94.0.1.
Escape character is '^]'.
?
1
test
hello
^A^S^G^F^C^C^C^C^C^C^C^C^C
^]
telnet> quit
Connection closed.
Here is the test code being used.
//Initialize
State = 0
NetworkID = 0
NetworkData as String
Client as String
//Start hosting
NetworkID = HostNetwork("ServerTest", "TheServer", 9100)
State = 1
do
if NetworkID > 0 and IsNetworkActive(NetworkID)
print("Network Active")
print("Number of Clients: "+Str(GetNetworkNumClients(NetworkID)))
//cycle through all the clients
clientID = GetNetworkFirstClient(NetworkID)
//Print the Server Information
printc("Server Name:")
print(GetNetworkClientName ( NetworkID, clientID ))
printc(" NetworkID:")
print(NetworkID)
printc(" ClientID:")
print(clientID)
printc(" IP:")
print(GetDeviceIP())
print("")
print("Connections")
while clientID > 0
// print the client details
Print(" Client " + Str(clientID))
printc(" Status:")
// if the client has disconnected, it needs to be cleaned up and removed
if GetNetworkClientDisconnected(NetworkID, clientID)
// if the first item of client user data is not set (0 is default)
if GetNetworkClientUserData(NetworkID, clientID, 0) = 0
// set the first item of client user data to 1 so that we know we have already cleaned up (clients persist for a few cycles after being deleted)
SetNetworkClientUserData(NetworkID, clientID, 0, 1)
// delete the client (this will not be instant)
DeleteNetworkClient(NetworkID, clientID)
endif
Print(" Disconnected")
else
// if the client is connected, print its unique identifying name (chosen in the joinnetwork or hostnetwork commands)
Print(" Connected")
Print(" Name: " + GetNetworkClientName(NetworkID, clientID))
endif
// as this machine is the host, we can work out if the current client is the host by checking it against the current machine's id
if clientID = GetNetworkMyClientId(NetworkID)
Print(" Type: Host")
else
Print(" Type: Client")
endif
// move on to the next client
clientID = GetNetworkNextClient(NetworkID)
endwhile
else
Print("Network Setup Failed")
endif
//Check for Data
message = GetNetworkMessage(NetworkID)
while message <>0
NetworkData = GetNetworkMessageString(message)
print("Data:"+NetworkData)
DeleteNetworkMessage(message)
endwhile
// update the screen
Sync()
loop