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

file descriptors and socks (distro)  RSS feed

 
Zach Bell
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
greets,

i have a distributed networking environment that uses a dht and services many clients. id like to make this more robust with live backup servers that can spawn at certain intervals but keep the connected sockets, if any. some of these backup servers will be on the same machine (this post is about that) while the others will be migrated to others.

id like to do some socket manipulating in java. i would like to spawn copies of a server with sockets. so i gotta pass the sockets to the new java processes. in linux you can do this by using the int fd from the read func.

these docs show the func:
http://www.opengroup.org/onlinepubs/007908775/xsh/read.html

so you can pass the fd and then use it to read.

but in java, there dont see to be a way to be able to get this fd and have the socket read from it. the end point is the same so it should be doable. i see i could subclass my own socket impls but im not sure if that is the way to go.

does this maky sense?

thank you for the help!
zach
 
Henry Wong
author
Sheriff
Posts: 22837
119
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two applications on the same machine don't share file (socket) descriptors. If one application passes an FD to another application, that application either... Can't use it. Or using it is for something else, that happens to have the same FD.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!