Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > using tcp port via socket on windows 2000 server

Reply
Thread Tools

using tcp port via socket on windows 2000 server

 
 
seannakasone@yahoo.com
Guest
Posts: n/a
 
      03-18-2007
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

 
Reply With Quote
 
 
 
 
Brian Candler
Guest
Posts: n/a
 
      03-18-2007
On Sun, Mar 18, 2007 at 10:40:06AM +0900, http://www.velocityreviews.com/forums/(E-Mail Removed) 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-...ons.html#intro

Regards,

Brian.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
No error while sending via TCP Socket =?ISO-8859-15?Q?Martin_B=FCrkle?= Python 10 07-03-2006 04:50 PM
send tcp raw socket (bogus tcp header length) Tiger C Programming 5 05-01-2006 05:53 AM
Transmitting strings via tcp from a windows c++ client to a Java server qqq111 Java 19 03-01-2006 05:36 AM
NAT two outside TCP ports to one inside TCP port Kevin Cisco 1 11-10-2004 08:15 AM
get notepad on windows to front via tcp-server Roger Python 1 03-02-2004 04:33 PM



Advertisments