using tcp port via socket on windows 2000 server

Discussion in 'Ruby' started by seannakasone@yahoo.com, Mar 18, 2007.

  1. Guest

    Here's a very simple ruby app that will listen to tcp port 9990. It
    works on my client windows xp machine, but when i put it on windows
    2000 server, it doesn't work. no port filtering is being done, so i'm
    assuming that all ports are available. any suggestions? how do i
    find out what ports are available.

    require 'socket'
    sessions = {}
    serv=TCPServer.new('localhost',9990)
    puts 'Server running...'
    while(session = serv.accept)
    command = session.gets
    puts command
    end
    , Mar 18, 2007
    #1
    1. Advertising

  2. On Sun, Mar 18, 2007 at 10:40:06AM +0900, wrote:
    > Here's a very simple ruby app that will listen to tcp port 9990. It
    > works on my client windows xp machine, but when i put it on windows
    > 2000 server, it doesn't work. no port filtering is being done, so i'm
    > assuming that all ports are available. any suggestions? how do i
    > find out what ports are available.
    >
    > require 'socket'
    > sessions = {}
    > serv=TCPServer.new('localhost',9990)
    > puts 'Server running...'
    > while(session = serv.accept)
    > command = session.gets
    > puts command
    > end


    I don't have a Windows 2000 machine, but I think in any case you'll need to
    provide more details for anyone to be able to help you. What do you mean by
    "it doesn't work"? It could mean:

    - the program raises an exception (if so, post the exact error message)

    - a client gets 'connection refused' when it tries to connect to port 9990
    (if so, this means the server isn't listening on port 9990)

    - the client can connect, but when it sends a string, nothing is displayed
    on the server

    - the server doesn't get as far as printing "Server running..."

    - probably a bunch of other failure modes that I haven't thought of.

    One easy thing you can try is to use '127.0.0.1' instead of 'localhost'.
    Perhaps Windows 2000 doesn't define the name "localhost" for you.

    But without seeing a description of the error, it's very hard to help you.
    More advice here: http://www.catb.org/~esr/faqs/smart-questions.html#intro

    Regards,

    Brian.
    Brian Candler, Mar 18, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. qqq111
    Replies:
    19
    Views:
    1,151
    Roedy Green
    Mar 1, 2006
  2. Roger
    Replies:
    1
    Views:
    293
    Larry Bates
    Mar 2, 2004
  3. Chetan Gadgil
    Replies:
    1
    Views:
    328
    Roger
    Mar 4, 2004
  4. Tiger
    Replies:
    5
    Views:
    966
    Dave Thompson
    May 1, 2006
  5. Adhik
    Replies:
    1
    Views:
    235
    Manohar Kamath [MVP]
    Sep 5, 2003
Loading...

Share This Page