Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Bind java socket to a specific device  RSS feed

 
Itzak Skenstrom
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know if it's possible to bind a socket to specific device like "eth0"? If so, how to I do that?
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to take a look at Java Tutorial: Custom Networking. We bind sockets to ports, which are abstractions of access points to the network. There are several layers of abstraction between the Java API and the physical device, for example, the protocol layer (tcp, udp), the transport layer (ip), and whatever API's the OS uses for physical access to the hardware, then the physical hardware iteself. The reason for the layered approach is to simplify programming at one particular layer. For example, when we write an application we don't have to worry about moving the data from our computer to the destination because the transport layer does it for us.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!