I´m using tsnet to connect to an API with results from rallying (motorsports). At the same time i have asked my program to open a socket waiting for information when the cars passes the goal line.
TSNET
The tsnet connections delivers information in JSON that is transfoRmed to an Array with 50 or so lines. The tsnet-connection is over the internet.
SOCKET
I use port 1100 for the socket command. The message is coming in locally from another software on the same machine (localhost:1100).
The socket connection delivers a string of 15-20 characters.
MY PROBLEM
The tsnet-processes stops the information coming in over the open socket.
How can I work around this? Can I use tsnet to oisten on a port. Or have I missed something?
Jakob Rubenson
CODE: SOCKET
on mouseUp pMouseButton
accept connections on port 11000 with message "clientConnected"
read from socket pSocket with message "messageReceived"
end mouseUp
on clientConnected pSocket
read from socket pSocket with message "messageReceived"
end clientConnected
on messageReceived pSocket, pMsg
put pMsg into theTime
read from socket pSocket with message "messageReceived"
end messageReceived
Socket and tsnet
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Socket and tsnet
@JakobR: What tsNet commands/functions are you using? It is possible that the blocking forms of the tsNet API (the Sync) could cause this; so perhaps try the non-blocking (callback-based) ones...
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: Socket and tsnet
Jakob- is that actual code? You're using port 11000 instead of 1100.
Also, I think the extra lines might cause you trouble.
Possibly use different ports for sending vs receiving?
Maybe something like
Also, I think the extra lines might cause you trouble.
Possibly use different ports for sending vs receiving?
Maybe something like
Code: Select all
on mouseUp pMouseButton
accept connections on port 1100 with message "clientConnected"
end mouseUp
on clientConnected pSocket
read from socket pSocket until EOL with message "messageReceived"
end clientConnected
on messageReceived pSocket, pMsg
put pMsg into theTime
read from socket pSocket until EOL with message "messageReceived"
end messageReceived
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev