Gadgeteer TCP-Connection

127.0.0.1 is not a valid IP address. You can not use that. It is a loopback address, a way to fudge connecting to a network on the same device, without ever really transiting out onto the network.

You have what I assume is a PC, running the node.js service, correct ? And you have implemented a connection from your PC to the node.js service, using 127.0.0.1, correct, and that all works as expected?

Your netmf device is 192.168.1.5.

You now need the 192.168.1.x address that your PC responds to. That is the device address you need as your target to go from the netmf device. If you don’t do that then you will never connect.

But there’s a good chance that your port 8080 is being blocked by the firewall, it is not something that is always enabled by default.

code tags. [code] goes at the start of your code, the closing [/code] goes at the end. You can use the pencil icon to edit the posts and fix it up.

Hi Brett,I’m new at how server and client work.

if port 8080 is not so good wich one may i use?
PC- IP address= 192.168.1.100
Gagdeteer IP address= 129.168.1.5

the server exists on my PC so I need to connect the gadgeteer to the PC ? So I mean sockett. connect going to be like this:

socket.connect(“192.168.1.100”, 8008 )
and the server will listen on IP address = 0.0.0.0 and port=8080 wlch means it will listen on all IP addresses who want to connect to port 8080.

Is it correct ?

In general yes what you’re thinking is correct. The “server” has to listen in for any inbound connection on a defined port. The client needs to open the connection to the destination IP address on that port.

8080 may not be a good choice because it may not be configured in your firewall as an inbound port - any port you choose may not make sense, you really need to know what you’re doing here and put in appropriate rules / exclusions in your firewall software, if you’re not using something like a standard web server and it’s associated port, port 80. If you have a 2nd PC you could test that to prove that you can get to the server, rather than trying to debug two unknowns at the same time.

Tank you guys! my Gadgeteer works now ;D . However I still have a little issue with the port. I have to turn off the firewall to make it work. I’m using port 80. Any suggestions?

Great that you’ve got it working!! :slight_smile:

As regarding to the firewall, if your PC and netmf device are at your home network and your home network is protected by a router with firewall you can disable the firewall on your PC. That way you can develop and start testing and eliminate all external factors. You can deal with those factors when you’re done developing.

Keep up the development :slight_smile:

I wouldn’t take quite that lenient a view - the firewall is there to protect you against things you don’t know are happening to any network, so prolonged running without it is unhealthy. What OS are you running ?

@ brett: Just for testing purposes, as soon as things are working as they should, you should bring it one step further and start configuring your firewall.

btw I’m using a Mac with OSX and vmware fusion

yes, sorry, I should have clarified. My question about the OS was for @ sam_simsim. :slight_smile:

I have windows 7 :slight_smile:

I created new inbound and outbound rules, but they did not worke :confused: