Page 1 of 1

Unabled to connect

Posted: Mon Mar 15, 2010 4:29 am
by edgar
Hey Guys,
I'm using SB70LC, now its running a Modbus Application. The Modbus Server/Slave works great but now i'm having an issue when i'm trying to connect to another controller. I execute the 'connect' and it times out, i see activity but for some reason i can connect. Is theirs anything i'm doing wrong? This is a TCP to TCP app.

Code within a Class object: The controller is on a DHCP network.
const char *pIP = "xx.yy.zz.aa";

IPADDR addr = AsciiToIp(pIP);
m_handle = connect(addr,0,502,TICKS_PER_SECOND*10);
Operation times out and m_handle is always -1.

Please let me know if i'm missing something.

Ed

Re: Unabled to connect

Posted: Mon Mar 15, 2010 4:48 pm
by tod
Probably need a little more info here. But you can try a couple of things, just to exonerate the NetBurner client. Assuming you have a PC on the LAN with your NB. Can you ping the controller? If so, can you open a DOS prompt and Telnet in using port 502?

If you can do that then you know nothing between you and the controller is blocking that port (like a firewall), and noone else is already using that port. So make sure you ctrl-] and quit Telnet before going on.

Please excuse my potential ignorance but I don't know anything about ModBus and I'm assuming it's somewhat irrelevant to your question as you're just trying to connect over TCP/IP from a client to a server.

I'm assuming that you don't have "xx.yy.zz.aa" in your ip string but some actual valid address you didn't want to disclose (or maybe there's a magic address I don't know about?) Other than that your use of connect() looks fine.

Is the controller on the same LAN as you? Do you have physical access to it?

Re: Unabled to connect

Posted: Wed Mar 24, 2010 2:59 pm
by edgar
Thank you guys, Problem was solved with netburner tech support. The solution was as simple as adding a local port randomization mechanism.

Ed