• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

ethernet-to-serial

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was searching, without results, for a java code that emulate these ethernet-to-serial devices.

That is a computer B with a ethernet and a serial port and another computer A with just a ethernet port.

A "device driver" in A simulates a serial port. All information sended to this port goes to ethernet port in B and routed internally to serial port with proper handshaking. The same for reading.

I saw hardware devices but I am looking for a softwate emulation, in java.

Any idea ?.

Thanks.
 
author
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java doesn't have access to the TCP/IP stack below the transport layer, so you really can't write anything that requires direct access to the Ethernet hardware in Java. Sorry. :-(
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Going off topic, that rattled a bit in my brain ... if a PC has two network cards and I open a server socket, how do we know which card / network / protocol will see the port as accessible?
 
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I remember well it is a JVM parameter that instructs which is the default network card to be used.

./pope
 
Elliotte Rusty Harold
author
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By default, a ServerSocket will listen on all available network interfaces, including each Ethernet card and localhost, as well as all virtual IP addresses mapped to the Ethernet cards. You can restrict this by IP or hostname. This example is taken from Chapter 10, Sockets for Servers:

For example, login.ibiblio.org is a particular Linux box in North Carolina. It�s connected to the Internet with the IP address 152.2.210.122. The same box has a second Ethernet card with the local IP address 192.168.210.122 that is not visible from the public Internet, only from the local network. If for some reason I wanted to run a server on this host that only responded to local connections from within the same network, I could create a server socket that listens on port 5,776 of 192.168.210.122 but not on port 5,776 of 152.2.210.122, like so:

 
Stan James
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, makes sense each card would have its own IP address. Hard to believe I actually passed a network class once I was wondering if we could tie this back to the original request and make a Java software ethernet-to-serial solution, or any kinda input to any kinda output. That is pretty much the whole magic of "inter" in the Internet.
 
reply
    Bookmark Topic Watch Topic
  • New Topic