What I have tried: I dont have any idea to proceed further for this virtual com port simulator.
Create Virtual Port Driver Which PretendsWhat you need to create is a device driver which pretends to be a com port, and those arent simple, not at all.
If you want this to test your software, then Id strongly suggest that you do go third party, or, use a second port on your machine via a null modem cable to provide the device emulation. For third party: com0com seems popular, but I havent used it myself. That will be the instance used in production. Create Virtual Port Code Depend OnMake your other code depend on your interface instead of the real port. Create a dummy port which implements your interface, and add the logic for emulating the device. You may create further dummies which simulate communication problems - now you can test that your code copes with that, too. Create Virtual Port Serial Port WillThe message that I want to send from a virtual serial port will be redirected to a portal using the TCP protocol. Then the portal sends the received message and redirects it to the other pcs serial port. For this I tested and I want to simulate the program Serial to Ethernet Connector using c. This program allow me to create client connection that will initiate local real or virtual serial port data redirection to the remote server using TCPIP protocol. For now I created a simply TCP Client using QT and I can send QString to the server (the portal) but that I want is write some strings from a hyper terminal (such as Putty) that is open in the virtual serial port (COMx) that I have to create. Now, for create a virtual serial port, I searched on the web and I found the CreateFile function. HANDLE driver CreateFileA(.COM15, GENERICREAD GENERICWRITE, 0, 0, CREATENEW, 0, 0). Why The function that I used is not correct What function I should use for create a driver that allow me to create a virtual com port using c. Its a quite complex topic, you have to decide what kind of driver you want to make, more on MSDN. It must be the driver that creates the device first, then you can use CreateFile to open it. That for one means that you must never hard-code the port name, you need config to allow the user to select it. Please be more specific and try do describe your task, sounds a little bit like XY problem to me. The server is created by this socat command: socat -d -d pty,linkdevttyS0,raw,echo0 tcp-listen:1234 Is it clear now. Is it physically present in your PC or do you have any FT232 USB convertor that creates COMx device when connected Also please kindly edit your question with clarifications, dont use comments for that. Know someone who can answer Share a link to this question via email, Twitter, or Facebook. Provide details and share your research But avoid Asking for help, clarification, or responding to other answers. Making statements based on opinion; back them up with references or personal experience. Browse other questions tagged c windows-10 drivers virtual-serial-port or ask your own question.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |