Quote: "I'll try and see if somehow closing one socket add nuls to other sockets..."
Indeed this is happening.
Here is the code:
if listenerID > zero
if SocketId < one // no connection
socketID = GetSocketListenerConnection( listenerID )
else // already connected
// are there more connections?
i = GetSocketListenerConnection( listenerID )
if i = socketID // added this check temporarily to confirm that we are not getting a duplicate ID, and we dont.
addlog ("Dup socket ID obtained:" + str(i))
endif
if i > zero // another connection
Command as string
j as integer
command ="{NAME}" + cName + chr(13) + "{MSG}Already connected to " + GetSocketRemoteIP(socketID ) + chr(13)+ "{BYE}" + chr(13)
for j = one to len(Command) + one
SendSocketByte( i, asc(mid(Command,j,one)) )
next j
FlushSocket(i)
addlog ("Rejected connection from:" + GetSocketRemoteIP(i))
deletesocket(i)
endif
endif
else
SetupListener()
endif // listenerID
Here is my log window on the AppGameKit app showing the results that get logged:
Note we get no message stating we got a duplicate socket ID
After the second connection was rejected, the other side of the first connection reported that the next {PING} command had a spurious nul byte
Unless anyone can explain why working with a second socket should add a nul byte to a first socket, I'll write this up as bug.