Author Topic: TCP Client Socket  (Read 4318 times)

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5261
    • View Profile
    • AdvancedHMI
TCP Client Socket
« on: January 21, 2018, 12:45:54 PM »
The attached component is a group of files that will add a generic TCP client. After adding the files and building the solution, you will get a new component in the Toolbox. Add this to your form, set the IPAddress and port number, then double click the component to get back to the code that will receive the data from the server.

An example of its use would be an Serial to Ethernet converter with a barcode scanner hooked up to the serial port. This component will receive the data from the scanner.

Installation and use:

- Download and unzip the files
- Open your AdvancedHMI solution in Visual Studio
- In Solution Explorer, expand down the AdvancedHMIControls project
- Right click the PurchasedControls folder and select Add-Existing Items
- Browse to the extracted files and select all 4 files
- Build the solution
- Open the Mainform
- From the ToolBox, add a GenericTCPClient to your form
- Set the IPAddress and port to that of your TCP server
- Double click the GenericTcpClient1 component which will take you back to the code
- Enter this code:

MsgBox ("Received: " & e.DataAsString)

- Run the application and have your server send data


It also has the capability to send data back to the server like this:

GenericTCPClient1.SendString("MyDataString")
« Last Edit: January 21, 2018, 12:50:09 PM by Archie »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5261
    • View Profile
    • AdvancedHMI
Re: TCP Client Socket
« Reply #1 on: January 21, 2018, 02:12:02 PM »
This is a software tool that can be used for testing the GenericTCPClient. Use the TCP Server tab

https://www.hw-group.com//products/hercules/index_en.html

seth350

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: TCP Client Socket
« Reply #2 on: January 25, 2018, 09:35:41 PM »
Now this is something I could use. Thank you Archie!
I need to send a String to a Domino DSeries laser marker and I think this will do the trick.

Definitely easier to do it in AHMI than in the plc, in my case that is.

Holmux

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: TCP Client Socket
« Reply #3 on: December 17, 2020, 01:03:23 PM »
Thanks Archie

I know this is an old post, but You just saved this Christmas for me :)

/Holmux