TCP Connect


Am new to the TCP method, I have try to send TCP Packet on localhost with my desktop application

But TCP was not connected.

Help me out.

TCPSocket1.Address =“”
TCPSocket1.Port = 1833

If TCPSocket1.IsConnected Then
MsgBox(“Not Connected”)

For localhost use address = “localhost” otherwise your firewall may require you to open the port. Are you communicating with another Xojo Application? How are you “listening” in that?

I try to communicate with “Hercules” software

TCP server - Hercules -listing port - 1833
TCP Client - Xojo application

The socket works async so it can’t be connected immediately after you want to connect.

Either you have to add your TCPSocket to a window and the implement the events Connected and Error. Or you have to do an AddHandler for the events and create methods for the events.

Have a look at the examples that come with Xojo.