SetIPAddress
Top  Previous  Next

Description

Sets the IP configuration of the virtual camera device.

[C++]
int
 SetIpAddress(const char* ip, const char* mask=NULL, const char* gateway=NULL);


Parameters
[C/C++]
 
[in] const char* ip  
String specifying the ip address of the camera in the IPv4 format (four decimals in the range of 0-255 separated by dots).  
 
[in] const char* mask  
String specifying the subnet mask in the IPv4 format. If this parameter is NULL or omitted, the mask of a connected interface will be used.  
 
[in] const char* gateway  
String specifying the gateway in the IPv4 format. If this parameter is NULL or omitted, the gateway of a connected interface will be used.  
 

Return Values


S_OK  
Success  
E_FAIL  
Failure  
E_INVALIDARG  
Wrong IPv4 format  
 
 
Example
 
This fragment of code sets the IP address, MAC address and serial number of the virtual camera and connects it to a matching network interface:

m_pCamera->SetIpAddress ("169.254.101.102", "255.255.0.0");  
m_pCamera->SetMacAddress("AA-11-12-13-14-15");  
m_pCamera->SetSerialNumber("10001");  
      m_pCamera->Connect("169.254.1.100"
);
 

Remarks


When a virtual camera device is connected to a network interface, it is automatically assigned the IP address and subnet mask of the interface. SetIpAddress allows you to modify the default IP configuration of the virtual camera. This is especially useful when you need to run several virtual camera devices on the same network interface. Assigning each virtual camera a unique IP address (as well as MAC address and serial number) will effectively simulate multiple GigE Vision cameras connected to one network card through a Gigabit switch.

Note that the IP configuration assigned to the virtual camera should match the IP address and subnet mask of the network adapter to which the camera will be connected to. If the camera is assigned a non-matching IP address, an external client software would have to use the Force IP protocol to correct the camera's IP configuration before it could connect to the camera.

The camera must be in the disconnected state in order for SetIpAddress to work.

If you have only one virtual camera connected to each network adapter, using this method is not recommended other than for testing purposes.