Vicks EDG-4516+ user manual Example EDG-4508+U

Page 82

Example (EDG-4508+U):

SOCKADDR_IN HostAddr; SOCKET HostSock; SOCKADDR_IN ClntAddr; SOCKET ClntSock;

int ClntAddrLen; char RxData[256];

memset(&HostAddr, 0, sizeof(SOCKADDR_IN)); HostAddr..sin_family = AF_INET; HostAddr..sin_addr.s_addr = INADDR_ANY; HostAddr.sin_port = htons(5201);

//Define the TCP port of host PC. It's the same as the value that you key- in it in the "Peer for Receiving Data" item of configuration utility//

HostSock = socket(AF_INET, SOCK_STREAM, 0);

//Create the socket of TCP on the Host// bind(HostSock,(sockaddr *)&HostAddr, sizeof(HostAddr)); listen(HostSock, 1); ClntAddrLen=sizeof(ClntAddr);

ClntSock = accept(HostSock, (sockaddr *)&ClntAddr, &ClntAddrLen);

//The host PC accepts the connection request from the EDG-4508+U/ EDG-4516+U //

recv(ClntSock, RxData, 256, 0);

//Receive the data from the port of EDG-4508+U/EDG-4516+U // closesocket(ClntSock);

//Disconnect from the EDG-4508+U/EDG-4516+U //

EDG-4508+/4516+ User Manual

70

Image 82
Contents EDG-4516+ Port Ethernet to RS-232/422/485 Data GatewayCopyright Acknowledgments CE Notification Product Warranty 2 years FCC Class a Technical Support and Assistance Packing ListContents Chapter Console Configuration Chapter Event and DI/O Monitoring Chapter Troubleshooting Appendix a Overview Features IntroductionSpecifications Packing ChecklistPage Getting Started Installation Flow Chart Understanding EDG-4508+ and EDG-4516+ Connecting Hardware EDG-4508+/4516+ Front PanelEDG-4508+/4516+ LED Indicators and Connectors EDG-4508+/4516+ LED & Connector Definitions EDG-4508+/4516+ Rear Panel Rack Mounting Rack MountingEthernet Connector of EDG-4508+/4516+ Network ConnectionPower Supply Connection Serial Port ConnectionOrdering Information Installation Install/Uninstall Driver & UtilityPage Page Page Page Configuration Auto Search When you run the EDG configuration utility for Locating EDG-4508+/4516+ Device Name Device System ConfigurationEthernet Data Gateway Device DescriptionTCP/IP Option IP address, Subnet Mask, Default Gateway Network ConfigurationDuplex Mode Ethernet Option MAC AddressName Port ConfigurationPort Setting DescriptionPort Configuration TypeParity Flow ControlData Bits Stop BitsBaud Rate Set All PortHost Idle Timeout Auto ReconnectionAllow any IP to access Security ConfigurationOnly configure the allowed IP Specified IP can access EDG devicePage Port Mapping Utility Virtual COM Port Settings OverviewPort of Installed Device Module of Installed DeviceIP Address of Installed Device Properties Auto Reconnect FunctionAdd MemoAdd All Inquiring Virtual COM Port Setting Updating EDG Firmware Updating FirmwareSelf Test Function TestSignal Test Communication Parameters TestApply DeleteExit If you want to quit the utility, please click on Save the Configuration Web-Based Configuration Access Web All new configurations will take effect after EDG-4508+ and EDG-4516+ provide RS-232 DI/O Event Configuration Reset Configuration Console Configuration Hyper Terminal Connection Connecting the cableCreating a new connection COM Port Setting Selecting a COM PortConnecting Successfully Command ListVersion Usage version Date displays or sets the date Usage date Time displays or sets the time Usage timeYou should use the net save command to Port Event Exit RebootPing WebPage Universal Serial Device Gateway EDG-4508+/4516+ Firmware updated procedure File Name DescriptionPress Start button to start the firmware download procedure Page Only configure the authorized IP TCP Port numberSpecified IP which can access Port ModeHow do you restore the firmware to EDG-4508+/4516+? File Name Description Page Network Architecture and Example Code Polling Network Architecture 12 Network Architecture-PollingExample EDG-4508+U Event-handling Network Architecture 14 Network architecture Event-handlingExample EDG-4508+U Peer-to-Peer Network Architecture 16 Network architecture Peer-to-peer18 #1 EDG-4508+U Configuration Utility 19 #2 EDG-4508+U Configuration Utility 20 Key-in information of #2 EDG-4508+U 22 Communication parameters of #1 EDG-4508+U 3Web-BasedConfigurationforEDG-4508+U/4516+U Access webNetwork Configuration Port Configuration Reset Configuration Cnsole Configuration for EDG-4508+U/4516+U4 DI/O Event Configuration Command ListDate displays or sets the date VersionLog Time displays or sets the timeNet You should use the net save command to Event Ping Event and DI/O Monitoring Event and DI/O Monitoring Polling MonitoringEvent Monitoring DI Value Inverse Option Page How to use the sample files? Programming I/OEdgevtio.dsp Edgevtio.dswMbtcp.h ModbustcpmsghdrlengthTroubleshooting Configuration Utility can not find EDG Series Cannot change the IP address or other server propertiesPage Page Appendix Appendix a RS-232 Pin Assignment RJ-48 Cable PIN AssignmentRS-422 RS-485100