Home/Support/Support Forum/TCP/IP Parameters query
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

TCP/IP Parameters query

0 votes
Hi,

At the top of my program (For an OP7200) I have the following:
#define TCPCONFIG 1

#define MY_IP_ADDRESS "182.16.1.200"
#define MY_NETMASK "255.255.255.0"
#define MY_GATEWAY "182.16.1.200"
#define PORT 4001
#use dcrtcp.lib

Yet the device will only respond on 10.10.6.100 which is the default.
How do I get the device to accept my chosen IP address?

I tried using TCPCONFIG 6 but that didn't work either.
asked Oct 24, 2007 in Rabbit by KennyM New to the Community (13 points)

Please log in or register to answer this question.

7 Answers

0 votes
Do you have tcp_config.lib for this processor? In my copy of tcp_config.lib (for the Rabbit 4000) the IP address and other paramters have names slightly different from those in your code snippet:

#define _PRIMARY_STATIC_IP "1.2.3.4"
...
#define _PRIMARY_NETMASK "255.255.255.0"
...
#define MY_NAMESERVER "1.2.3.208"
...
#define MY_GATEWAY "1.2.3.200"

Try just modifying these in tcp_config.lib, and temporarily comment out all the stuff in your main source file except for the

#define TCPCONFIG 1
answered Oct 24, 2007 by cpu New to the Community (19 points)
0 votes
Thanks for the quick reply.
I guess I could do that - but I hate having to edit the default libraries, that's something I didn't think would be good. What happens if I have want to program several devices with the same code but different IP addresses - I'd need to edit the LIB everytime...
answered Oct 24, 2007 by KennyM New to the Community (13 points)
0 votes
Found that the correct way to use a specific IP address is to use the following:
#define MY_IP_ADDRESS "169.254.39.200"
#define MY_NETMASK "255.255.255.0"
#define MY_GATEWAY "169.254.39.2"
#define PORT 4001
#define TCPCONFIG 0
#define USE_ETHERNET 1
#use dcrtcp.lib

The imporant line is the #define TCPCONFIG 0
You can also use #define TCPCONFIG 100 and put the macros in a user-suppled custom_config.lib
answered Oct 26, 2007 by KennyM New to the Community (13 points)
0 votes
Hi, there is an even better way in which you can set and change the IP subnet and gateway during runtime. This way, you can have functions that can change these settings in a "live" environment, very useful to me because alot of my installations are about 2 - 3 km underground in the gold mines (south africa). If you would like a code sample then shout.

Now I also have a question that I guess may be useful to many people. I am not a networking person, so I don't know all the terms, but I want to use my Rabbit on DHCP, and give it a name (as your PC would have a name on the network). Then I would want to access my Rabbit over the network using its name rather than IP address. Does anyone know if that's possible?

Thanks,

John
answered Nov 7, 2007 by Johnno New to the Community (6 points)
0 votes
John,
I would like to look at the technique you used for setting the netmask and gateway at run-time.

I am working on code to set several network config settings at run-time using ifconfig(). I'm using another board to send a serial message to the Rabbit containing all the network settings. The Rabbit parses that and then calls ifconfig().

Thanks
Carl
answered Nov 9, 2007 by cpu New to the Community (19 points)
0 votes
KennyM;1001 wrote:
Thanks for the quick reply.
I guess I could do that - but I hate having to edit the default libraries, that's something I didn't think would be good. What happens if I have want to program several devices with the same code but different IP addresses - I'd need to edit the LIB everytime...

I just edited tcp_config.lib to get a quick start and verify connectivity. Ultimately I also used TCPCONFIG 0 and used the default tcp_config.lib.
answered Nov 9, 2007 by cpu New to the Community (19 points)
0 votes
Johnno;1039 wrote:
Hi, there is an even better way in which you can set and change the IP subnet and gateway during runtime. This way, you can have functions that can change these settings in a "live" environment, ... If you would like a code sample then shout.

That's a problem I'm currently trying to figure out. If you have a code sample you can post to the forums, that would be great.

Edit: I found the solution in this post.
answered Jul 19, 2008 by bobpaul New to the Community (2 points)
...