3

I've read the Ruby documentation but I didn't really get what the difference is between these two objects.

TCPServer.new(port) and TCPServer.open("X.X.X.X", port)

All I know is that .new only responds to clients (and only those on the same computer) trying to connect to "localhost" for the IP. It doesn't even work when a client tries to connect to 127.0.0.0, which is supposedly the same as "localhost". But .open lets me allow people from outside my computer connect. I never supplied an IP to .new but only to .open as you can see above. I'm just trying to get a feel for how these two work in general so any info would be helpful! Thank you!

cyclingLinguist
  • 334
  • 1
  • 5
  • 16

1 Answers1

0

They are the same. In Programming Ruby 1.9, it said:

open: Synonym for TCPServer.new
totally
  • 135
  • 8