# Looking for COM port emulation over LAN

## stenny

I want to connect my PBX to my network by means of a COM to LAN bridge. This is a piece of hardware, that connects serial communication lines (aka RS232) to an ethernet based network. With this, I can contact my PBX on my LAN. Unfortunately, the PBX configuration program expects to see the device on the serial port of my PC.

Is there a driver, which emulates a serial port via /dev/ttySx and exchanges the data over the LAN?

Any hint is appreciated very much

thank you

     stenny

----------

## nahpets

What about this:

```

* net-misc/ser2net

     Available versions:  2.1 ~2.2 ~2.2-r1

     Installed:           no

     Homepage:            http://sourceforge.net/projects/ser2net

     Description:         Serial To Network Proxy

```

----------

## stenny

Thanky you nahpets. Looked good at the first glance, but didn't stand further examination. "ser2net" in fact is a ethernet to serial proxy. It takes network connections and routes them to a serial port on the same computer. I'm looking for a pure emulation of a serial port. I don't want to use a physical serial port on my machine. What I'm looking for works as follows:

An application on my PC opens a virtual serial port "/dev/ttyS99". This opening establishes a network connection to a remote device, which owns the serial port the application wants to talk to. 

regards

    stefan

----------

## nahpets

Hmm... Sounds like you may need to write some custom code to do that.  It shouldn't be too difficult to do in your language of choice.  From what I understand, you just need a program on the server side that listens to incoming TCP traffic and then forwards to a serial port.

----------

## Taladar

You could try putting something together with netcat and a fifo.

----------

## stenny

 *nahpets wrote:*   

> Hmm... Sounds like you may need to write some custom code to do that.  It shouldn't be too difficult to do in your language of choice.  From what I understand, you just need a program on the server side that listens to incoming TCP traffic and then forwards to a serial port.

 

Close to it  :Very Happy: 

The server side is a ready-built module, which uses Lantronix' Xport (see http://www.lantronix.com/device-networking/embedded-device-servers/xport.html). I'm looking for the client side, which wants to communicate to the device connected to the serial port of the Xport module. So this specific "serial line" is elongated by my in-house LAN. You surely know the USB to RS232 adapters and the drivers for those modules. Just replace USB by Ethernet and you know, what I'm looking for.

----------

## nahpets

Can this be it??

```

slattach             (8)  - attach a network interface to a serial line

```

Try "man slattach"...  Looks promising.

Otherwise, I'm sure you can maybe fool your kernel into thinking that a fifo you make with "mkfifo" is a serial port or something using "setserial" or something similar.  Maybe "udev" can also help you.

----------

## stenny

 :Very Happy:  it took me a while, but now I found, what I'm looking for:

```
stenny@delos ~ $ esearch socat

[ Results for search key : socat ]

[ Applications found : 1 ]

*  net-misc/socat

      Latest version available: 1.4.2.0

      Latest version installed: [ Not Installed ]

      Size of downloaded files: 259 kB

      Homepage:    http://www.dest-unreach.org/socat/

      Description: Multipurpose relay (SOcket CAT)

      License:     GPL-2
```

----------

## Massimo B.

I'm looking exactly for the same thing, a Ethernet-RS232 gateway. This  German HowTo describes how to use your Lantronix together with socat.

I'm wondering if and how that could work with that device I have:  Advantech  ADAM-4570L .

There is no webserver provided:

```
Interesting ports on 10.0.0.1:

(The 65534 ports scanned but not shown below are in state: filtered)

PORT     STATE SERVICE

5202/tcp open  unknown
```

Doing the configuration on a MS Windows system using the provided application would be aceptable if connection would work with linux afterwards.

----------

## Massimo B.

Now I found  Moxa NPort 5210 and the developers finally provided me with beta sources for TTY modules that successfully build on 2.6.16-gentoo-r9.

I got myself a unit and transmission works.

There is a new kernel modul, virtual com ports /dev/ttyr00 and /dev/ttyr01, a web and telnet console with many networking and serial settings.

But there's one problem I encounter: As soon as a process is connected to the serial port, it cannot disconnect anymore. gpsd hangs on disconnecting, sometimes  cat /dev/ttyr00 . I even can't  kill -9  the process, reload the module nor continue using that port.

----------

