0

Specify Port on roTCPServer

I could not find anything in the documentation to indicate the default TCP port, nor how to specify a different TCP port for the roTCPServer object.

 

I'm attempting to define a roTCPServer, watch for a roTCPConnectionEvent and create an roTCPStream. However, without a port specified, I can't find a way to actually connect from an outside device.

Any help is greatly appreciated.

5 comments

  • 0
    Avatar
    Jean Michel

    What about BindToPort? Sounds promising enough to me:

    Prepares to accept incoming TCP connections on the specified port. Passing an integer to this method will specify a standard port number.

    -JM

  • 0
    Avatar
    Nick Miller

    Thanks Jean,

    It looks like BindToPort specifies which interface to expect the inbound connections, not the specific TCP Port.

  • 0
    Avatar
    Lyndon

    No it specifies port as well. the exmaple provided indicates you can bind to an interface if you pass an associative array into the call. If you pass an integer, that's the port that's used. 

  • 0
    Avatar
    Jean Michel

    Yes, that's how I interpreted the docs, although it could have been more clear, so I can see how the OP could misunderstand it.

    -JM

  • 0
    Avatar
    Bright Scripters

    This seems to work 

    server = CreateObject("roTcpServer")
    server.SetPort(msgPort)
    server.BindToPort( 12345 ) ' TCP port for incoming connection
     
    The documentation also shows how to use an Associative Array as argument to BindToPort(), but it wasn't clear to me enough to show an example here.
Please sign in to leave a comment.