daneren2005 / ServerProxy

ServerProxy is a Android library for creating proxy servers to serve files
GNU General Public License v3.0
27 stars 22 forks source link

SocketTimeoutException on socket.accept() #6

Open neslihanturan opened 7 years ago

neslihanturan commented 7 years ago

Hi, I just tried this library for a media player application. But I get SocketTimeoutException in ServerProxy.java file, at line 115. The code is on that line is very critical: "Socket client = socket.accept();". It is normal because you set socket timeout to 5 seconds. However, my question is why connection is never established (even if I remove timeout, it waits forever)? Did you experience such case?

spartacus777 commented 7 years ago

+1 same problem

daneren2005 commented 7 years ago

You can increase the timeout, but you shouldn't be getting a SocketTimeoutException because it is being handled in the loop: https://github.com/daneren2005/ServerProxy/blob/master/src/github/daneren2005/serverproxy/ServerProxy.java#L126. How are you trying to connect to the ServerProxy after you start it? Are you using getPrivateAddress()?