How two processes can access one serial port ttyUSB3.


I want to write a code for Receiving SMS in python for AirPrime(MC8705) wireless module And at the same time other process is also using the serial port.
What is the way to resolve this issue…

Following AT commands i am using for SMS receive code :
AT+CMGF=1 #Set text mode for SMS
AT+CNMI=1,1,0,0,0 #Set value for New Message Indicator.
Now when new SMS arrived, i need to read the serial port for +CTMI status # Problem starts from here.
AT+CMGR= #to read new sms

Please provide some solution. Thanks


Even if the operating system allows you to have two processes open a serial serial port simultaneously (which it probably won’t), you’re going to be in for a world of pain trying to work out what comms data belongs to what process.

The correct way to do it is to write a daemon/broker/manager application that manages the serial port, and your other processes connect to the daemon using some form of Inter process communication [IPC] (Sockets/Message Queues/Shared Memory or similar). The daemon listens on the port and somehow (you need to think about this bit - maybe just send the data to each process via IPC) works out what is received and which process it belongs to; and listens to the IPC and sends data out the serial port.

ciao, Dave

As Dave says, Operating Systems don’t let multiple processes open the same port for very good reasons - so you are going to have to devise a scheme to share the port and ensure that the processes don’t interfere with each other …