I have one desktop application which is communicating with another Device(Monitor) via serial to USB.
I have one communication board which is connecting both the application. It has chip from CP2100 family.
That communication board is powered up by Device(Monitor) and both the application start exchanging the data. But when I'm turn off the Device(Monitor), Port which is enumerated for desktop application is lost and when turn on the device(Monitor), port is comming back but in this case desktop application is not sending the data to Device(Monitor).
I have used serial port setting to get the current port for desktop application.
Please help me to solve this problem.
I would use this function to enumerate the COM port list and while not connected to a device, loop through the com list and try and connect. If you can connect, see if you get a response back you expect, if you do you know this is the right COM port, otherwise move onto the next COM port.
string[] serialPortNames = System.IO.Ports.SerialPort.GetPortNames();
Related
My platform: Linux Kubuntu 14
I am currently working on a project in which my application is communicating with a process via rs232 connected to /dev/ttyS0 serial port.
Sometimes incoming messages aren't intercepted by my process so I decided to use a sniffing tool called jpnevulator.
From what I see, if I run my application together with the sniffing tool, some messages are intercepted by the sniffing tool and some by my application, but not both.
Is it not possible to listen via sniffing tool on a serial port while another application is using it?
Thanks
Thanks all for the helpful responses.
As suggested in https://unix.stackexchange.com/questions...
I used interceptty to link a pseudo terminal to the serial port I am listening to and connected my application to the pseudo terminal and it worked.
I recently started experimenting with TCP/IP in Java (question not Java specific), and I was wondering if there was a work-around to this problem: I want my Client to be able to list all available Local Network servers. This is easy when every server and client use the same port, eg. 48,000 - just cycle through every possible IP and ping any existing servers...
But what if a user already had a game open that was using port 48,000? The game would just crash with no work around. A fix would be for the server to loop and test every port between say 48,000 and 60,000, but then how would the client know which port to connect to?
I want to be able to list all available servers (like a game such as Halo does), without the user having to specify a port number.
Thanks for the help
We have a fully-working java programme which can connect to another computer and can send messages from this(both sides run java and we used ObexPutClient and ObexServer), however when trying to connect to the NXT Brick and send a message via bluetooth we are able to pair with the brick and we can send a message but we have no idea if the NXT receives it.
When we tried to use Java ObexPutClient on computer(we provide the ServerURL of NXT to java programme) to send the message to NXT Brick running the RobotC, it does't work. On java side, the error is given:
"Failed to connect; [10064] A socket operation failed because the destination host was down."
Is the error we receive on Java.
Using robotc the brick is waiting for a message to be sent and it is awaiting 3 integers to help the robot move.
How have people sucessfully done this, we have ensured the port number is the same.
The NXT does not provide the OBEX Bluetooth service. It uses the Serial Port Profile (SPP - also sometimes called RFCOMM). When you pair your NXT with your host computer, it will create a serial port (e.g. COM4) on your host computer. In your Java program, you need to open this serial port and send data that way.
Also, leJOS has a PC Library (Java) that includes communication and remote control features. You could probably use this so you don't have to write your own.
I have an interesting problem. I am working on an embedded box with multiple instances of Linux running each on an ARM processor. They are connected over internal 1GBps network. I have a serial port device node attached to processor A (Lets say Linux-A running on it). I have a program running on processor B (Lets say on Linux-B) access the serial port device as if it is attached to Linux-B locally.
My program invokes term i/o type api calls on device node to control tty echo, character mode input. What I am wondering is if there is a way to create a virtual serial device that is available on Linux-B somehow talking to real serial device on Linux-A over internal network.
I am thinking something along the lines of:
Linux-B has /dev/ttyvirtual. Anything that gets written to it gets transported over network socket to Linux-A serialserver. The serial server exrcises the api calls on real device lets say /dev/ttys0.
Any data waiting on ttys0 gets transported back to /dev/ttyvirtual.
What are all the things involved to get this done fast?
Thanks
Videoguy
Update:
I found a discussion at
http://fixunix.com/bsd/261068-network-socket-serial-port-question.html with great pointers.
Another useful link is http://blog.philippklaus.de/2011/08/make-rs232-serial-devices-accessible-via-ethernet/
Take a look at openpty(3). This lets you create a pseudo-TTY (like /dev/pts/0, the sort that ssh connections use), which will respond as a normal TTY would, but give you direct programmatic control over the connections.
This way you can host a serial device (eg. /dev/pts/5) that you forward data between a network connection, and then other apps can perform serial operations on it without knowing about the underlying network bridge.
I ended up using socat
Examples can be found here: socat examples
You socat back to back on both the machines. One listens on a tcp port and forwards data to local virtual port or pty. The socat on other box uses real device as input and forwards any data to tcp port.
Here's the setup: I have two bluetooth devices paired with a single PC. Both are SPP, intended to be used with separate virtual COM ports. One device is assigned COM9, the other is assigned COM11. If I open the COM9 port, it 'sees' the data from the COM11-paired device, even though I didn't open the COM11 port.
It looks as if any data from a paired device, regardless of which COM port it is paired with, will be received on whatever COM port has been opened. I would have expected that data from the device paired with COM9 would only be received if I opened the COM9 virtual port, etc.
Can anyone tell me why the paired ports aren't behaving uniquely? Any way to force them to be unique?
typically I have seen 2 com ports (incoming and outgoing) that gets assigned to a single device, are you sure com 9 and 11 in your care are not the incoming and outgoing port to the same device ?
I have observed a similar behaviour on Windows 7 and Windows 8. I have paired two SPP Bluetooth devices. Thus Windows has created four virtual COM ports: one incoming and one outgoing for each device.
I then opened the two incoming ports. Nevertheless, I could not connect both devices simultaneously. The first one gets connected to whatever incoming port and the second one cannot connect as long as the first is connected.
It looks as if Windows can accept only one incoming connection, on whatever incoming virtual COM port.