kim taeyun
kim taeyun

Reputation: 1847

ruby socket connection to outside

I trying to make a connection with following ruby code

server

require 'socket'
puts "server"
socket = TCPServer.open(1000)
client = socket.accept
puts "connected"

client

require 'socket'

puts "client"
server= TCPSocket.open("172.30.1.2",1000)
puts "connected"

but client side always says target machine refused it.

no "connected" printing on both side

when I change "172.30.1.2" to "localhost", it works.

I wonder why I can't connect to my self

"172.30.1.2" is my IPv4 address

when I type ipconfig on cmd,

it says "172.30.1.2" is my ip.

I configure DMZ and port-forwarding too.

and all firewall is off.

I tried on windows xp and windows 7.

can someone help me?

(I want to connect to my computer from outside. and that's why I tried "172.30.1.2")

thanks.

Upvotes: 0

Views: 1008

Answers (1)

Yuri  Barbashov
Yuri Barbashov

Reputation: 5437

In order to create server use TCPServer.open("172.30.1.2",1000)

Upvotes: 3

Related Questions