TCPServer example?

I need to create a simple TCP server that will receive some text and respond with a value. I also need to transmit a data value to all of the clients connected to the TCP server once every second or half second (this is the weight on a scale).

I see that the Internet Pack has a TCPServer component but I can’t find documentation on how to use it or any examples. Do you have an example?

I’ve added an event handler for the OnTcpConnection event and save the connection to a list. However, when I attempt to connect to the server using HyperTerminal the connection only stays active for about a second.

Hello.

Please consider to use RemObjects SDK for your problem. Take a look at the attachment archive. It contains simple RemObjects SDK server with TCP channel that allows to get message from client and send it back to all clients. For sending messages back is used RemObjects SDK feature “Multicast Events”. See more about it at “http://wiki.remobjects.com/wiki/Multicast_Events”.

Also, please take a look at RemObjects SDK sample “SuperTCP Channel Chat” (see it at “C:\Users\Public\Documents\RemObjects Samples\RemObjects SDK for .NET\C#\SuperTCP Channel Chat”). It shows using SuperTCP channel in action.

Thanks
Testcase66256.zip (156.9 KB)

I would love to do it that way but unfortunately the other half of the connection is an outside developer that does not have RemObjects SDK and can’t get it (unless you’ve come up with a version for Allen Bradley PLCs?)

Hello Brian.

You can download RemObjects SDK trial version at http://www.remobjects.com/downloads.aspx and try to use it.

Thanks

Hello,

I have the fully licensed RemObjects SDK. The point that I’m trying to make is that the reason I want to use a TCP connection from the Internet Pack instead of the SDK is that the device on the other end isn’t a PC: It’s an Allen Bradley PLC. And there isn’t a version of RemObjects SDK available for that. The only viable option is to send / receive text strings via a TCP/IP connection, in this case the scale (my program) is the server and the PLC is the client. I have other TCP/IP components available but they aren’t designed to run on the .NET CF and your Internet Pack is.

Do you have any examples or documentation for the Internet Pack other than what is in the installed program?

Thank you,
Brian Wheatley

Hello.

In this case using RemObjects SDK is not the best solution. Please take a look at http://www.codeproject.com/Articles/1415/Introduction-to-TCP-client-server-in-C . It shows creating simple implementation of a TCP client server application. It can be used in your project

Please note that Internet Pack’s TcpClient class is just wrapper around native .NET class with some of additional functionality

Thanks