Results 1 to 3 of 3
  1. #1
    neeraj.singh is offline Member
    Join Date
    Feb 2009
    Location
    Delhi
    Posts
    63
    Rep Power
    0

    Default [SOLVED] problem in socket connection

    hello,

    i am new in socket programming..
    i am trying to run below code but it hangs when i call the accept() method on the serversocket's obj.

    Java Code:
    public class HTTPServer  {
        public static void main ( String a [  ]  )  throws Exception  {
        final int httpd = 80;
    
        ServerSocket ssock = new ServerSocket ( httpd ) ;
        System.out.println ( "have opened port 80 locally" ) ;
        try
        {
        Socket sock = ssock.accept (  ) ;
        System.out.println ( "client has made socket connection" ) ;
        }
        catch(java.io.IOException e)
        {
            System.out.println("Could establish the connection");
        }
        }
      }
    Please help me out...
    thanks
    /\/

  2. #2
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    8

    Default Any clients out there?

    Is there a corresponding client code trying to send something to the posted server code? Your code isn't hung... it's waiting for something to come through the port.

    Luck,
    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  3. #3
    neeraj.singh is offline Member
    Join Date
    Feb 2009
    Location
    Delhi
    Posts
    63
    Rep Power
    0

Similar Threads

  1. Replies: 3
    Last Post: 04-13-2010, 04:43 PM
  2. problem in socket connection in sending images
    By vibhor in forum Networking
    Replies: 2
    Last Post: 02-20-2009, 06:39 AM
  3. [SOLVED] Problem with socket programming(Vista)
    By jagatsastry in forum Networking
    Replies: 1
    Last Post: 02-02-2009, 04:56 PM
  4. Replies: 3
    Last Post: 01-26-2009, 06:30 PM
  5. How To Make Socket Connection
    By madhumurundi in forum Networking
    Replies: 5
    Last Post: 04-21-2008, 07:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •