Acessing a device on LAN


#1

hi
I am using WIZNET 107SR devices. I can use the setup program ConfigTool by
connecting the device to the PC’s ethernet port, to set the IPaddress, etc.

To access data through the device (by TCP from my PC program) I have to connect the
device to my router ethernet port.
Is it possible to do this when connected to the PC’s ethernet port? (maybe I need some sort of sever program on the PC?)

don


#2

It’s possible.
If the WIZ107SR is server you need the TCP client program and if the WIZ107SR is client you need the server program.
For the testing, you can use socket test program. http://openmicrolab.com/wp/wp-content/uploads/1/cfile10.uf.200C810C4BFC97B386191F.zip


#3

hi
Still not sure how I can go about doing this…
the WIZNET devices are server & my PC program (VB6 under WIN7) is client & makes a TCP connection
to them all and then sends data back/forth to the wiznet serial port.
So how can I make the PC talk to the device using a connection to the PC’s ethernet port, rarther than through a router ?
don


#4

Just connect to WIZ107SR module using Ethernet cable and set both (PC, WIZ107SR) IP address as in the same subnet.
for example: PC - 192.168.1.100, WIZ107SR - 192.168.1.200


#5

hi
How do I set the ‘PC to the same subnet’ ?
My PC program initiates a TCP connection to the Wiznet device, using the known IP address of the wiznet.

don


#6

You can change the module’s IP address or your PC’s address.
Below is the information about the “same subnet”

Part 1: How does the subnet mask actually work?

The subnet mask is a 4 part string of numbers just like the IP Address. Most of the time, it looks like this: 255.255.255.0. The purpose of the subnet mask is to define what numbers of the IP Address should be the same for the computers to be on the same subnet. When it comes down to it, it’s all binary. Wherever there is a 1, this means that the numbers must be the same on the two (or however many) IP addresses. Here is an example that will help to bring this concept to light:

Lets say that the Subnet Mask is 255.255.128.0. To analyze this, we must first convert this to binary format:

1111 1111 . 1111 1111 . 1000 0000 . 0000 0000

Looking at the first number 1111 1111, there is a 1 in every spot. This means that the bits of the IP Addresses must be the same in every spot. In other words, the numbers must be the exact same. The second number is the same way.

Looking at the third number 1000 0000, there is a 1 in the 8th spot. This means that only the 8th binary digits of the IP Addresses must be the same. So, if we have a number like 131 (which is 1000 0011) for one IP address, then for another computer to be on the same IP address it has to have the 8th number be a 1 (that is the only constraint). This means that 255 (which is 1111 1111), 128 (which is 1000 0000), etc will be on the same subnet. This is shown because if you align these 3 numbers, they each have one thing in common: the 8th number is the same for each.

1000 0011
1111 1111
1000 0000

Part 2: How do I find out what my computer’s current IP Address and subnet mask are?

To do this, you follow these instructions:
Go to the command prompt usually found at Start»Programs»Accessories.
Once the command prompt comes up, type in ipconfig.

After this, it should return your computer’s IP Address and Subnet Mask.

Part 3: How can I set my computer’s IP Address and subnet mask?

To set your computer IP address statically:
Select Control Panel»Network Connections. Right click on Local Area Connection and select properties.
Once you are inside the Local Area Connection properties, go to the General Tab and select Internet Protocol (TCP/IP) and click on properties.
Once you have done this, you will be left with a window that will allow you set your IP statically (which allows you to set it) or with DHCP (which allows the network to set it dynamically).


#7

Thanks. I will try this is a few days time…
Do you know any Windows API calls that would allow me to set the PC’s IP address from inside a
VB6 program?
don


#8

Sorry. It’s beyond of my scope and you’d better googling it or refer to MSDN.

Thanks.