Forward data from ip socket to bluetooth socket. c# - 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.

Related

How to connect plc with eternet port?

I have a plc with eternet port.
I want to connect between PLC and my PC through TCP/IP.
How can it be done ?
using (TcpClient client = new TcpClient())
{
Console.WriteLine("Attempting to connect to the server ","on port 8000.");
client.Connect(IPAddress.Parse("192.168.1.97"), 8000);
}
The question needs a bit more details... but I will write some considerations:
a modern PLC typically can manage an TCP/IP stack and most has already an integrated webserver at some port (80?), depending on the kind of PLC you can have some info and maybe access to I/O data.
The connection is straightforward like any other TCP/IP device providing an IP and a port address, if the socket does not connect means there is nothing responding
If you are not connecting to an already working server in the PLC, as some noted in comments You should implement in the PLC program a server loop that answers to your requests, you have to check vendor documentation

How to create TCP proxy for SSL stream

There's a transparent BLE to IP communication established between mobile (Xamarin) and BLE device.
The high-level diagram is the following:
Mobile TCP/IP socket <---> BLE Central <---> BLE Peripheral <---> SSL server on device
I want to establish TLS session over BLE, for this purpose the client connects to Mobile TCP/IP server socket over SSLStream, but on a method AuthenticateAsClient it hangs and mobile TCP/IP socket doesn't receive any data.
Taking in account that SSL is located above TCP I was expecting that TCP socket will receive all data related to SSL handshake process..
Please advise any ideas how to solve this.

C# and modbus/tcp

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.

Intercept TCP and UDP traffic localhost

Is there a way to intercept TCP and UDP traffic that is inside localhost on Windows in C#? For example an app running on localhost sending messages through TCP and/or UDP on localhost... I need to intercept these to determine the efficiency of data of the program, for this I'm building an utility tool in C# (need a self build solution no product)
Usually you have to use program like wireshark to capture loopback (127.0.0.1) traffic, but it's impossible for libpcap on Windows. (read this note)
You have to use Raw Cap if you want to sniff the loopback interface

NP304 3onedata C# socket send directly from server to device.

How can I send data from my C# socket program to my clients?
Currently I have two programs, server and client.
I start my server, then my clients connect to server, in this way they are connected together, but now I want to send directly from server to client?
As my client cannot start its own connection, of course I have IP and port of my client, how can I send data from my server to a client with known IP and port?
Thanks.
Since your clients are not computer programs you can control, you really have no chance but to contact them from the server. If your clients can handle TCP communications, you need to treat them as servers, and Connect from the server to each client (open the socket on the server side, and Connect to each client IP and port).
It's possible that your clients understand UDP and not TCP. That is actually going to be easier for you, as you only need to create one UDP socket, and use SendTo to send a data to each client (one SendTo call per client).
Let's just hope your clients aren't stuck on the Ethernet level...
I would say that COM-ports are slightly easy to communicate than implementing TCP/IP protocol on your device. Could your device read/write its COM-port?

Categories