C# and modbus/tcp - c#

I need to read some data from a rs485 device. It is connected to a Aport-211W and this one is connected to my local network. This device opens a server on port 502 and this is the rs485 port of the device I wanted to read. The protocoll is modbus.
My first try was to link this mobus/tcp to a local COM Port on my computer with this Software and read everything through it. But I dont want to use an other software for this and now my question is: How can i directly connect from a C# program to the modbus/tcp server and read data out?
I have already found some libraries but none of them is able to connect to the device. I have closed the Serial Port Redirector because it blocks the communication. Has anybody done something like this before?

Aport-211W is just a gateway between your MODBUS device (probably MODBUS RTU) and network. It does not do any protocol conversion, which means that you have MODBUS RTU over TCP and not plain MODBUS TCP protocol. These are different protocols, and you need to adjust according to that.

Well, you can write on yourself if you want, that way u can contol the stuff ur self and will be bespoke.
mostly, it would be Modbus RTU over TCP from the Slave.
Just create sockets to communicate with the Aport as they communicate through TCP.

Related

Is an open TCP Port in C# secure?

I am sorry, this is kind of a noob question, but I don't get how ports work.
I think that when I open a tcp port in C# via the TcpListener on the server, anyone can connect to it. However, I only want my application client to connect to the port and send my predefined packets. Would it be possible for any person to connect to the port and send data that might harm my computer? Or is it just possible to send random data that is then just wrongly interpreted by my packet handlers?
I hope I could communicate my question clearly. Thanks in advance
Securing a port is generally a function of the operating system or the network infrastructure (could be as simple as a software firewall). You can use something like iptables to allow incoming connections from whitelisted IP addresses only.
If you want to do it through software, the server and client can use symmetric encryption. Only clients that know the key will be able to send meaningful messages. All other messages can be safely discarded.

Listen to Serial over TCP/IP Port C# ASP

I'm developing a weather site, with several weather stations. Ever station uses a different method to post data to the server. They all work, except one. It's a brand new station, but uses a serial port. The company that installed the station connected the station to a Moxa Serial converter. Witch essentially sends the serial data over a specific TCP port to my remote server. Using Pccomm Terminal Emilator I can receive the data on my server. But how should I get my app to listen to this port for serial data. I tried Tcplistener, but it doesn't receive any data. Data is in NMEA format.
Thanks for the suggestions!
Without more specifics I can only give you some general hints, but here goes:
Many Serial-to-Ethernet converters include server-side software that will make the data appear on a virtual serial port. If that is the case, with the software installed you will see the virtual port listed along with the real ports in your system. You can simply open and read from that port as usual.
If that is not the case, but you are receiving data on a known TCP port and can view it using Telnet or something similar, then perhaps the Moxa converter is acting as a server and expects you to be the client. In that case you would want to use the TCPClient class rather than the TCPListener class.
The Moxa converter (you didn't give the model number) has a manual which may prove helpful.
If you need more help then you will need to post specifics about exactly how you are connecting with PComm and what you see, and exactly what you tried with TCPListener, and what happened.
gl

Sending TCP Packets through IP Address

I know you can send UDP, HTTP, and TCP packets in java to a specific IP address. Since i'm learning c# i decided to make a Low Orbit Ion Cannon. Basically its used for stress testing network. So i'm kinda curious is their anyway to send TCP packets in c#. Could you give me some code examples? I tried to look online but couldn't find anything.
I would have a look at http://msdn.microsoft.com/en-us/library/system.net.sockets.socket(v=vs.110).aspx for an introduction of what C# can do for you using a socket. And http://www.csharp-examples.net/socket-send-receive/ has an example of send and receive using a socket.

Forward data from ip socket to bluetooth socket. c#

I want to listen to incoming ip sockets on a specific port and forward them using bluetooth sockets.
Is this possible?
I'm using c# but I can use java if it's easier to code.
In fact, the object was using SMB protocol over Bluetooth connexion. I found a Bluetooth profile that is similar to SMB protocol and that enables me to explore the sdcard from my PC. the profile is OBEX FTP (File Transfert Profile) and i found java APIs.
Thank you for your answers.
The Bluetooth equivalent of TCP sockets are called RFCOMM sockets. You can write an app to open a TCP socket, read the data, and write it out to an RFCOMM socket.

how can I send dial-up message through external modem connected serial port?

I connect the external modem to the pc with serial port.
so i want to connect server through dial-up method with C#.
And then, send and receive message.
How can i solve this problem? please.
Can I use serialport component of .NET?
Yes.
You'll need to find out from the server specs what type of message to send, but yes, you would use the SerialPort object.
Here's a starting point for you.
http://www.dreamincode.net/forums/showtopic35775.htm
And the Bing search I used to find it.
http://www.bing.com/search?q=C%23+modem+communications+via+serialport&src=IE-SearchBox&FORM=IE8SRC

Categories