Setting static IP using development board?
Posted: Thu Dec 08, 2011 3:38 am
Hello all,
It should be noted that on top of having just begun using NB products, its also been years since I've done any significant coding; so if some of my questions seem elementary, I apologize.
I have a MOD5270 with a development board. Ultimately, the implementation will have several NB modules on a mobile network that will need to be assembled, disassembled, and power cycled on a regular basis. Each NB is also going to need to be assigned some sort of simple identifier so that whatever computer is at the head of this network can easily decide which NB it needs to send/receive data from. For ease of use it would be preferential that each NB can be assigned an identifier inside the code using a dial of sorts attached to each NB. Basically, using a development board, I can set this identifier using the dip switch on the board. So if I want a NB to be identified as "Number 1" I can just set the dip switch to that number and have the code read that identifier.
At this current point in time, the program on the computer connects to the NB using a TCP connection, reads the value of the dip switch, and stores that value using the NB's currently assigned ip address (given out by a DHCP server) as the identifier for that NB. Example, the computer opens a TCP connection to x.x.x.101 and reads the dip switch value 5. Now anytime the computer wants to send/receive data on NB 5 it knows to select x.x.x.101. The complication arising when the network is power cycled, NB 5 may be assigned a different ip address and thus the TCP call for the identifier has to be done over again and restore the value on the computer.
So my question is this: for simplicity sake, is there an easy way to assign the NB a static ip address based on the dip switch value? This way the computer doesnt have to make the TCP call and store the identifiers after each power cycle, it can simply use the convention of NB 5 is always going to be at ip x.x.x.5, etc.
It should be noted that on top of having just begun using NB products, its also been years since I've done any significant coding; so if some of my questions seem elementary, I apologize.
I have a MOD5270 with a development board. Ultimately, the implementation will have several NB modules on a mobile network that will need to be assembled, disassembled, and power cycled on a regular basis. Each NB is also going to need to be assigned some sort of simple identifier so that whatever computer is at the head of this network can easily decide which NB it needs to send/receive data from. For ease of use it would be preferential that each NB can be assigned an identifier inside the code using a dial of sorts attached to each NB. Basically, using a development board, I can set this identifier using the dip switch on the board. So if I want a NB to be identified as "Number 1" I can just set the dip switch to that number and have the code read that identifier.
At this current point in time, the program on the computer connects to the NB using a TCP connection, reads the value of the dip switch, and stores that value using the NB's currently assigned ip address (given out by a DHCP server) as the identifier for that NB. Example, the computer opens a TCP connection to x.x.x.101 and reads the dip switch value 5. Now anytime the computer wants to send/receive data on NB 5 it knows to select x.x.x.101. The complication arising when the network is power cycled, NB 5 may be assigned a different ip address and thus the TCP call for the identifier has to be done over again and restore the value on the computer.
So my question is this: for simplicity sake, is there an easy way to assign the NB a static ip address based on the dip switch value? This way the computer doesnt have to make the TCP call and store the identifiers after each power cycle, it can simply use the convention of NB 5 is always going to be at ip x.x.x.5, etc.