Results 1 to 2 of 2
- 07-29-2009, 12:35 PM #1
Member
- Join Date
- Jul 2009
- Posts
- 3
- Rep Power
- 0
Can I pass sockets to different threads?
Hallo, I am writing a client/server program and I am having troubles passing sockets among classes.
Basically, the client connects to a login manager, which checks credentials and then passes the socket to another class for further communication.
If i close the DataInputStream and the DataOutputStream, I get a "socket closed" exception when i try to open new ones in the "other" class (although I did not close the socket itself), whereas if I do not close the streams, I get a EOFException. :confused:
Maybe my login thread closes the socket when it dies, even though that socket is referenced in another thread?
I am starting to think that it is not possible to achieve what I was trying to do and that I'd need to open a new socket, but I'd rather not if possible so please let me know if it can be done...
- 07-29-2009, 11:05 PM #2
Member
- Join Date
- Jul 2009
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
Sockets NIO
By aamp in forum New To JavaReplies: 3Last Post: 01-15-2009, 10:56 AM -
Threads + Sockets
By Tomdarkness in forum New To JavaReplies: 1Last Post: 12-24-2008, 12:06 AM -
Sockets
By Zosden in forum NetworkingReplies: 16Last Post: 05-27-2008, 04:55 PM -
Help with Sockets
By Eric in forum NetworkingReplies: 3Last Post: 12-01-2007, 08:09 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks