• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Socket connection

 
Anton Brass
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

I implemented a socket based connection for the UrlyBird project.

Is it true that the connection is only useable once?

I tried to build up the connection inside the constructor of my Client class:


For the first action, everything works fine. If I try to send another message I get a "Access time out" SocketException. My Server code is following:

 
Anton Brass
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I forgot to wrote that if I initialize and close the connection for every request, it works totally fine.
 
Dennis Grimbergen
Ranch Hand
Posts: 159
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like your SocketRequest thread dies.
Did you put a



inside you run() method to prevent it from ending?
 
Anton Brass
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, could be the problem. I had it this way:



And will change it now to

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic