I am using the following skeleton program, DC 9.21, and Windows Vista
Home BASIC in my test:
- Run the following program under DC 9.21
- Turn on Vista PC
- Connect a cross over cable between rabbit and Vista PC
- Rabbit first try DHCP and fall back to 192.168.0.123
but VistaPC will come up in IPv6! and we can’t talk to rabbit
Once Rabbit falls back to 192.168.0.123, if we disable/enable the
network controller on Vista PC, it will come up with IPv4, and everything will
begin to play
I also tried embedded ethernet controller from Lantronix called XPORT,
and it didn’t cause Vista to switch to IPv6
If I uses a XP PC instead of Vista PC, everything works
If I connect the VistaPC and Rabbit to a DHCP based network, Vista PC
will come up as IPv4 and everything will play
Disabling “IPv6 on VistaPC” doesn’t solve the problem: VistaPC simply come up with no network in our test
If rabbit is forced to come up with static IP (without DHCP at all), VistaPC will come up in IPv4
I am convinced rabbit’s DHCP section is having a conflict with Vista
Any advise?
Thanks!
>>>>>>>>skeleton.c
#define USE_STDIO
#class auto
#define MAX_TCP_SEG 50
#define TCPCONFIG 3
#define ETH_MTU 1500
//#define TCP_BUF_SIZE 32768
#define VS_MAXOFFSET 2
#define DHCP_MINRETRY 1
#define VS_INIT 0
#define VS_LISTEN 1
#define VS_OPENING 2
#define VS_OPEN 3
#define VS_WAITCLOSE 4
#define VS_MODEOFF 0
#define VS_MODEACTIVE 1
#define VS_MODEPASSIVE 2
#define TCP_PORT 23
#memmap xmem
#use “tcp_config.lib”
#ifndef DHCP_CLASS_ID
#define DHCP_CLASS_ID “Rabbit_DI731ENA:Z-World:DHCP:1.2.0”
#endif
#ifndef DHCP_CLIENT_ID_MAC
#define DHCP_CLIENT_ID_MAC
#endif
#memmap xmem
#use “dcrtcp.lib”
typedef struct
{
int state;
tcp_Socket socket;
} VsState;
VsState vs_state;
void vs_init(VsState* vs_state)
{
vs_state->state=VS_INIT;
}
void vs_handler(VsState* state)
{
auto tcp_Socket* socket;
int iread, i;
char iInput[255];
socket=&state->socket;
if(state->state!=VS_INIT && tcp_tick(socket)==0) {
state->state=VS_INIT;
}
switch(state->state)
{
case VS_OPEN:
iread=sock_dataready(socket);
if (iread>0){
if (iread>200) iread=200;
i=sock_read(socket, iInput, iread );
sock_fastwrite(socket,iInput, i);
}
break;
case VS_INIT:
tcp_listen(socket,TCP_PORT,0,0,NULL,0);
state->state=VS_LISTEN;
break;
case VS_LISTEN:
case VS_OPENING:
if(sock_established(socket)) {
state->state=VS_OPEN;
sock_mode(socket,TCP_MODE_BINARY);
}
break;
case VS_WAITCLOSE:
break;
default:
state->state=VS_INIT;
break;
}
}
root void main()
{
char ipbuf[16];
sock_init();
#define myDHCP 1
#ifdef myDHCP
ifconfig (IF_ETH0,
IFS_IPADDR, aton(“192.168.0.123”),
IFS_ICMP_CONFIG, 1,
IFS_DHCP, 1,
// IFS_DHCP_TIMEOUT, 20,
IFS_DHCP_FALLBACK, 1,
IFS_UP,
IFS_END);
#else
ifconfig (IF_ETH0,
IFS_DHCP, 0,
IFS_IPADDR, aton(“192.168.0.123”),
IFS_UP,
IFS_END);
#endif
vs_init(&vs_state);
while (ifpending(IF_ETH0) == 1){
tcp_tick(NULL);
}
Enable_HW_WDT();
printf (“Reset!”);
while (1) {
tcp_tick(NULL);
vs_handler(&vs_state);
}
}