how to convert RS232 communication to TCP/IP communication - winapi

I have a created hardware communicating application using RS232 protocol in MFC. But as there is problem regarding voltage signal strength, i would like to shift from RS232 to TCP/IP.
Can anyone help me on this topic...?

The solution is to extend the microcontroller board with a serial device server.
Known brands are Lantronix or Moxa, but there are many other options and manufacturers. For an "embedded" solution that is integrated on your board, the "Lantronix XPort" is a typical product.
http://www.lantronix.com/device-networking/embedded-device-servers/xport.html
(I'm not affiliated with the Lantronix company.)
The Serial Device Server will connect to your RS232 on one end, and on its TCP/Ethernet side it offers usually a TCP server. It is usually configurable via network, through a built-in web interface, much like an Internet router.
Your PC application then needs to be changed as follows: Instead of opening a Windows COM port, you need to make a TCP client connection to that server, on a preconfigured TCP port. (Lantronix has 10001 as the default TCP port for this.)
But there is also special Windows driver software that lets you talk to your Serial Device Server / your microcontroller through a "virtual COM port". This is sometimes the best solution for legacy PC applications, where you cannot change the original code and have to use a Windows COM port. For a MFC application this might be a good choice.

Related

What Windows 10 driver model is appropriate for implementing IP link layer?

I'm looking to write a simple Windows driver to enable running TCP/IP over a proprietary RF module. The module already provides Ethernet-style data packets with source/destination MAC, so I just need to layer IP packets (generated by the regular Microsoft IPv4 subsystem), set the MTU appropriately so they will be the right size, and then call the module's serial API. I'll need to be able to handle transmit statuses and implement an ARP protocol as well. I want the driver to expose a new interface similar to a wifi or ethernet card in Network Connections and use the normal Windows IP stack.
The module is UART and might be connected via FTDI chip, RS-232 converter, or native UART on an IoT Core board, so it will just be talking to a generic serial port. I am fine with only running on Windows 10, but I'm still not sure what to use. Can I use the UWP VPN provider? Do I need to write an NDIS miniport driver, or an interface provider? Also, how will I handle the driver needing complete control over the serial port at all times? I can't write a serial driver as it might be connected via many different types of serial ports.

Developing a Mac OSX Network Driver for a Serial Port AT Command Based Modem

First allow me to say that I don't have any experience developing drivers for OSX, nor drivers for Windows. So, there are a lot of things that I don't understand about how drivers work; I'm sure it'll be evident in my question.
I have a modem that is able to open and close TCP/UDP sockets using AT commands. I would like to create some kind of program (kernel extension? driver?) that implements a network driver, converting the network interface calls into AT command serial messages.
That's the basic jist of it. I'm essentially asking if anybody can point me in the right direction / give me a high level overview of how they would approach it and what Apple guides to focus on.
The XNU networking stack -- like most network stacks -- expects network devices to send and receive IP packets directly. It isn't tooled to work with network devices that handle part of the network stack (like TCP or UDP) internally -- it won't be possible to implement a network driver which uses this device.
You might have more luck exposing this device as a SOCKS proxy. You will need to write a userspace daemon which listens on a TCP port on localhost (on the computer) and relays traffic to the serial device; once that's done, you can set the computer to use that device as a SOCKS proxy in the Networking control panel.
(As an aside: most devices that implement this type of interface have a very low limit on the number of open sockets -- often fewer than 10. They're unlikely to be able to handle the network load generated by a desktop OS.)

LAN Port as controller

i need only to get any voltage out from my laptop to control a relay
how to get a signal from a LAN port from any pin ?
in my laptop there is no com Port or lpt Port
also the usb port needs interfacing circuits which is not nessesary
in my simple project
thats why i choosed the LAN Port
i use (visual basic 6)
any help would much appriciated .
While such things as PoE exist, normal ports do not provide any power to external devices. The USB ports are far more likely candidates since they are designed to support powering external devices, though the amount of current supported varies by adapter/hub (most "ports" are actually internal hub ports).

How to access ethernet port using VC++? without using sockets

I'm a beginner to ethernet programming, I want to access the ethernet port and send/recieve packets to/from it. I thought of using the CIM_EthernetPort class, but don't know how to do it. please help. I have to write a program to send data to an embedded system.
I don't think you quite understand what sockets are.
What protocol does your embedded device use? If it's TCP or UDP (or even a raw link protocol) it's pretty much using a socket by definition.
The only reason you might need to talk to an ethernet adapter without using sockets is if you want to write something like a wire level monitor or packet sniffer.
ps -------------------------------------------------------------
Sockets are just an abstraction of a network connection, since a UDP connection has an endpoint and a port it's a bit philosophical wether you are using sockets if you talk directly to the network card hardware.
You don't specify a baud rate as such on ethernet, the card hw will negotiate a speed.
There is very little overhead in sending data by UDP using sockets and it's usually a very efficent way of receiving data. Do you have an RTOS on the embedded device or were you trying to talk to the network adaptor directly with some sort of polling?
pps ------------------------------------------------------------------
If it is at all possible to use UDP on the embedded device - DO SO.
If you start with, I just need to send a few numbers, you ultimately end up re-inventing and re-solving all the things UDP was invented to do.
By using standard protocols you also get tools to let you test each end of the connection (there are UDP equivalents of hyperterm for free).
Also there is no need for multiple devices now, but there may be in the future. I argued for using UDP on a previous product I worked on - where the designers were thinking of ethernet as just a faster serial link. Being able to network many units of this product together has created a huge new market.

Locked Serial Port on Vista

I'm working on an App that talks to a serial port, and on my development machine, I'm running Vista, and that serial port is a Bluetooth connection. Occasionally, the serial port gets caught in a state where my App can no longer connect to it. In .net I get an IOException with a message reading "Element not found."
I've tried restarting the App, connecting with other Apps (a communications client like HyperTerm) but nothing helps. I can't find any more specific error message, and nothing is logged to the machine's event logs. The device manager tells me the port is "working properly."
Is there any way to find out which process and or .dll has possession of a serial port, and/or force a port closed?
If it makes any difference, my App is in C#, but structurally, it's not convenient to open and close the port with a "using" statement.
Thanks,
Andy
To the best of my knowledge you can't close a serial port that you do not have the handle to. My experience of Bluetooth serial ports is that they can end up getting mapped to different COM port numbers at connection time, and can sometimes leave bogus COM ports when disconnected. For example, I currently have no bluetooth devices connected, but if I go into device manager, I see a total of eleven COM ports listed as Bluetooth serial port The properties on each of these ports show the device as working and available, and I can usually open these ports though I get occasional failures. My work around for this is to force COM port numbers for connected deviced, through properties / advanced / COM port number. I'm not sure if the problem is driver related (IVT corp in this case) or a problem with the way Windows manages blutooth serial ports.
Sorry I couldn't be of any more help.

Resources