Internet PLC Forum

General => Technical support => Topic started by: Netanel on March 16, 2020, 01:28:41 PM

Title: FMD1616 - Open Socket TCP as server(slave)
Post by: Netanel on March 16, 2020, 01:28:41 PM
Hi

How can i open TCP Socket as server(slave)?

How can i open UDP Socket as Client?

Thanks

Title: Re: FMD1616 - Open Socket TCP as server(slave)
Post by: support on March 16, 2020, 03:39:06 PM
The FMD1616 PLC server socket is always open. So you just need the client to connect to it. iTRiLOGI is a client that can connect to the PLC's server socket.

The TBASIC language does not have built-in support for user initiated UDP client connection to external UDP server. Only TCP client connection is supported.
Title: Re: FMD1616 - Open Socket TCP as server(slave)
Post by: Netanel on March 16, 2020, 11:11:07 PM
"iTRiLOGI is a client that can connect to the PLC's server socket", FMD1616 can connect to Linux server socket?
Title: Re: FMD1616 - Open Socket TCP as server(slave)
Post by: support on March 17, 2020, 12:21:15 AM
Yes if the Linux server is listening on a TCP socket the FMD1616 PLC is able to using PRINT #4 "<TCPCONNECT ...>" command to connect to the server port and interact with the server.
Title: Re: FMD1616 - Open Socket TCP as server(slave)
Post by: Netanel on March 19, 2020, 02:54:21 AM
 Thanks,
while i connect, disconnect, and reconnect, the port changes, can I define const(hard) port?

another question:

"The FMD1616 PLC server socket is always open" which type of server this?

i succeed to connect to FMD1616 PLC server
but i try to send the string "abc/n", i got error, what i did wrong?

how i read the data from the controller?

my c# code:

tcpclnt.Connect("192.168.1.5", 9080);
// use the ipaddress as in the server program
Console.WriteLine("Connected");
Console.Write("Enter the string to be transmitted : ");
String str = Console.ReadLine();
Stream stm = tcpclnt.GetStream();
ASCIIEncoding asen = new ASCIIEncoding();
byte[] ba = asen.GetBytes(str);
Console.WriteLine("Transmitting.....");
stm.Write(ba, 0, ba.Length);
Title: Re: FMD1616 - Open Socket TCP as server(slave)
Post by: support on March 19, 2020, 07:40:44 PM
You can only specify the destination port, not the source port. The source port is assigned by the OS and incremented after every connect disconnect which comply to internet RFC. You can't fix the source port number.

FMD1616 PLC server socket is to service the iTRILOGI client. It can also service HTTP protocol commands sent from a HTTPRequest process. Please refer to Chapter 2.7 of the FMD User Manual for details.