|
|
|
Philips Pronto Professional Forum - View Post
|
|
|
|
|
|
|
The following page was printed from RemoteCentral.com:
Setting up a socket to be a TCP listener
| |
|
Topic: | Setting up a socket to be a TCP listener This thread has 3 replies. Displaying all posts. |
|
Post 1 made on Saturday April 16, 2016 at 02:42 |
Barry Gordon Founding Member |
Joined: Posts: | August 2001 2,157 |
|
|
i know how to set up a UDP socket to listen at a port without connecting. I can not find info on how to do that for a TCP socket. Can it be done and if so how?
|
|
Post 2 made on Saturday April 16, 2016 at 16:55 |
Lyndel McGee RC Moderator |
Joined: Posts: | August 2001 12,992 |
|
|
Barry,
You need to have firmware 7.2.15 or higher. From the Beta Dev guide. You will need to use Port 1024 or higher as this is Linux and the socket must be non-blocking and use onConnect.
Now, on to capturing the instance of the client socket and not the server socket. I strongly suspect that Javascript 'this' evaluated during onConnect callback will be the client socket that you can later close, etc...
Lynde
A.13.5.3. tcpsocket.listen() (available since application version 7.2.15) Synopsis
tcpsocket.listen(port)
Purpose Start listening for inbound TCP connections.
Parameters port Integer Port number on which to listen.
Only port numbers 1024 or higher are supported, lower port numbers are reserved for the system.
Exceptions • Not enough arguments specified • Argument is not a positive integer number • Argument out of range • Socket is blocking • Address already in use • Socket not ready • Socket error
Additional info
The socket must be non-blocking, or an exception will be thrown. Furthermore, a given socket can only listen on a single port at once. When a new inbound TCP connection is established, the socket's onConnect callback will be invoked with a newly created TCPSocket instance as an argument. This new socket can then be used to communicate with the client
|
Lyndel McGee Philips Pronto Addict/Beta Tester
|
|
OP | Post 3 made on Monday July 11, 2016 at 13:42 |
Barry Gordon Founding Member |
Joined: Posts: | August 2001 2,157 |
|
|
Lyndel, I trust all is well, and maybe someday we will get together again.
Do you have a copy of the Beta dev guide that has the information on TCP listener that you can send me or point me to a downloadable copy.
Thanks, Barry
|
|
OP | Post 4 made on Tuesday July 12, 2016 at 17:52 |
Barry Gordon Founding Member |
Joined: Posts: | August 2001 2,157 |
|
|
Lyndel,
Never mind, I found the document in the files section on Remote central.
|
|
|
Before you can reply to a message... |
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now. |
Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.
|
|
|
|