How to open a port in Windows using Ruby? -


The firewall is enabled in my window system.

I would like to allow incoming connections on a particular port (say: 4546).

Is there a Ruby Library that can help me do this?

In detail: I have a sapphire application running on port 4546. To bring down the firewall to work, I'm looking for a way to keep port 4546 under the firewall list.

Yes, you do this with:

  Receive a socket from 'socket' # stdlib server = TCPServer.open (4546) # port 4546 socket to listen to loop # server # Always wait for client server = client to connect to client.puts ( Time.now.ctime) # Send time to client client "Close the connection. Bye!" Client.close Disconnect from Client}    

Comments