Author Topic: FMD1616 - Open Socket TCP as server(slave)  (Read 18366 times)

Netanel

  • Newbie
  • *
  • Posts: 5
    • View Profile
FMD1616 - Open Socket TCP as server(slave)
« 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


support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re: FMD1616 - Open Socket TCP as server(slave)
« Reply #1 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.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Netanel

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: FMD1616 - Open Socket TCP as server(slave)
« Reply #2 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?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re: FMD1616 - Open Socket TCP as server(slave)
« Reply #3 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.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Netanel

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: FMD1616 - Open Socket TCP as server(slave)
« Reply #4 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);
« Last Edit: March 19, 2020, 05:34:44 AM by Netanel »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re: FMD1616 - Open Socket TCP as server(slave)
« Reply #5 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.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS