Hi Arjun I'm now trying to implement a Web server, and I use IE and Chrome to connect to my server.
On Wed, Aug 4, 2010 at 3:38 AM, Arjun <[email protected]> wrote: > Can you please show some more information from the log cat.. > and at the same time need to see the client code where it gets > connected to the server port. > > I think it is sucefully creating the server socket, the problem seems > with the client and where client is not polling to the server port. > > Thanks, > Arjun. > > On Aug 3, 8:26 am, Alex Xin <[email protected]> wrote: > > Hi Oscar > > > > I have no firewall installed...... > > > > Alex > > > > On Tue, Aug 3, 2010 at 11:11 PM, Oscar <[email protected]> wrote: > > > Do you have a firewall or something like that, it´s maybe the problem > > > > > On Aug 3, 8:56 am, Alex Xin <[email protected]> wrote: > > > > Hi, > > > > > > I have asked this question before but no answers, so I post again > hope > > > that > > > > someone might help me, thank you. > > > > > > I'm now facing a very strange server socket problem, I have a server > that > > > > will listen on a TCP port, I use the following code to do this work. > > > > > > public class RequestListenerThread extends Thread { > > > > > > private final ServerSocket serversocket; > > > > > > public RequestListenerThread(int port, final String docroot) > > > > throws IOException { > > > > this.serversocket = new ServerSocket(port); > > > > setDaemon(true); > > > > > > } > > > > > > public void run() { > > > > Log.v("FE", "SMB Server Listening on port " > > > > + this.serversocket.getLocalPort()); > > > > > > while (!Thread.interrupted()) { > > > > try { > > > > // Setup incoming client connection > > > > Socket socket = this.serversocket.accept(); > > > > Log.v("FE", "Incoming connection from " > > > > + socket.getInetAddress()); > > > > // Start worker thread > > > > Thread t = new WorkerThread(socket); > > > > t.start();} catch (InterruptedIOException ex) { > > > > break; > > > > } catch (IOException e) { > > > > > > Log.v("FE", "Network I/O error: " > > > > + e.getMessage()); > > > > break;} > > > > } > > > > } > > > > > > } > > > > > > My target device is running on Android 1.6 & 2.1 > > > > > > When I run this code, it can start to listen on port but can't accept > any > > > > incoming connections. When it runs into serversocket.accept function, > it > > > > never return, just like dead lock. > > > > > > I found that if I establish any connections from my phone to > computer, > > > then > > > > my phone could be successfully found that there're incoming > connections > > > and > > > > of course, accept them. > > > > > > In emulator, above code works fine, has no this strange problem. > > > > > > Is that my phone's bug or I have something wrong in my code? > > > > > > Thanks a lot! > > > > > > Alex > > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Android Developers" group. > > > To post to this group, send email to > [email protected] > > > To unsubscribe from this group, send email to > > > [email protected]<android-developers%[email protected]> > <android-developers%[email protected]<android-developers%[email protected]> > > > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

