hd132x_k_v1r3_Final_.PDF

Similar documents
hd1300_k_v1r2_Final_.PDF

À©µµ³×Æ®¿÷ÇÁ·Î±×·¡¹Ö4Àå_ÃÖÁ¾

untitled

chapter4

T100MD+

(Asynchronous Mode) ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 -

TCP.IP.ppt

Sena Device Server Serial/IP TM Version

SRC PLUS 제어기 MANUAL

1217 WebTrafMon II

bn2019_2

TTA Verified : HomeGateway :, : (NEtwork Testing Team)

PowerPoint 프레젠테이션

시스코 무선랜 설치운영 매뉴얼(AP1200s_v1.1)

6주차.key

Network seminar.key

USB USB DV25 DV25 REC SRN-475S REC SRN-475S LAN POWER LAN POWER Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl C

(SW3704) Gingerbread Source Build & Working Guide

자바-11장N'1-502

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D D382E687770>

untitled

Remote UI Guide

ARMBOOT 1

untitled

Microsoft Word - FS_ZigBee_Manual_V1.3.docx

10X56_NWG_KOR.indd

Subnet Address Internet Network G Network Network class B networ

Microsoft PowerPoint - 09-CE-23-윈도우 소켓

1

MR-3000A-MAN.hwp

PWR PWR HDD HDD USB USB Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl Cable PC PC DDNS (

SMB_ICMP_UDP(huichang).PDF

LCD Display



Microsoft Word - ZIO-AP1500N-Manual.doc

소개 TeraStation 을 구입해 주셔서 감사합니다! 이 사용 설명서는 TeraStation 구성 정보를 제공합니다. 제품은 계속 업데이트되므로, 이 설명서의 이미지 및 텍스트는 사용자가 보유 중인 TeraStation 에 표시 된 이미지 및 텍스트와 약간 다를 수

cam_IG.book

Assign an IP Address and Access the Video Stream - Installation Guide

VZ94-한글매뉴얼

Microsoft Word - SMB-63-2_KR_.doc

안전을 위한 주의사항 제품을 올바르게 사용하여 위험이나 재산상의 피해를 미리 막기 위한 내용이므로 반드시 지켜 주시기 바랍니다. 2 경고 설치 관련 지시사항을 위반했을 때 심각한 상해가 발생하거나 사망에 이를 가능성이 있는 경우 설치하기 전에 반드시 본 기기의 전원을

Microsoft Word - KPMC-400,401 SW 사용 설명서

歯Cablexpert제안서.PDF

untitled


2009년 상반기 사업계획

13주-14주proc.PDF

1. GigE Camera Interface를 위한 최소 PC 사양 CPU : Intel Core 2 Duo, 2.4GHz이상 RAM : 2GB 이상 LANcard : Intel PRO/1000xT 이상 VGA : PCI x 16, VRAM DDR2 RAM 256MB

Microsoft Word doc

본 강의에 들어가기 전

MAX+plus II Getting Started - 무작정따라하기

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션

Analytics > Log & Crash Search > Unity ios SDK [Deprecated] Log & Crash Unity ios SDK. TOAST SDK. Log & Crash Unity SDK Log & Crash Search. Log & Cras

PowerPoint 프레젠테이션

ORANGE FOR ORACLE V4.0 INSTALLATION GUIDE (Online Upgrade) ORANGE CONFIGURATION ADMIN O

untitled

BJFHOMINQJPS.hwp

untitled

3ÆÄÆ®-11

K&R2 Reference Manual 번역본

歯Enet_목차_.PDF

Chapter11OSPF

강의10

Microsoft PowerPoint - Supplement-02-Socket Overview.ppt [호환 모드]

PCServerMgmt7

歯메뉴얼v2.04.doc

untitled

Microsoft Word - Installation and User Manual_CMD V2.2_.doc

K7VT2_QIG_v3

Interstage5 SOAP서비스 설정 가이드

목차 1. 개요 USB 드라이버 설치 (FTDI DRIVER) FTDI DRIVER 실행파일 USB 드라이버 확인방법 DEVICE-PROGRAMMER 설치 DEVICE-PROGRAMMER

PowerPoint 프레젠테이션

CANTUS Evaluation Board Ap. Note

한글사용설명서

The Pocket Guide to TCP/IP Sockets: C Version

歯9장.PDF

untitled

본 강의에 들어가기 전

제1장 Unix란 무엇인가?

The Pocket Guide to TCP/IP Sockets: C Version

개요

Microsoft Word - CL5000,5500_KOR_UM_ _.doc

s SINUMERIK 840C Service and User Manual DATA SAVING & LOADING & & /

Microsoft PowerPoint - XAD-400.ppt [호환 모드]

StruxureWare Data Center Expert 7.2.x 의 새 기능 StruxureWare Data Center Expert 7.2.x 릴리스에서 사용할 수 있는 새 기능에 대해 자세히 알아보십시오. 웹 클라이언트 시작 화면: StruxureWare Cen

untitled

GLOFA Series Cnet

CPX-E-EC_BES_C_ _ k1

untitled

1.LAN의 특징과 각종 방식

UDP Flooding Attack 공격과 방어

APOGEE Insight_KR_Base_3P11


歯규격(안).PDF

제20회_해킹방지워크샵_(이재석)

MPLAB C18 C


Microsoft PowerPoint - 12 ¼ÒÄÏÀ» ÀÌ¿ëÇÑ Åë½Å 1.ppt

Transcription:

HelloDevice ( HD1320E/1320/1321) Version 11 1

2

1 2 3 31 HD1320/1320E 311 312 313 RS232 32 HD1321 321 322 33 4 41 42 421 HD1320/1320E 422 HD1321 43 431 IP 432 IP 44 441 442 443 RS232 5 51 52 521 TCP 522 TCP 523 3

6 RS232-TCP/IP 61 TCP 611 TCP 612 TCP 613 TCP / 62 RS232 4

HelloDevice 1320/1320E/1321 1 HD132x HD1320E HD1320 HD1321 PCB PCB PCB 75V - - RS232 - - CD-ROM - - HelloDevice http://wwwsenacom/korean/hellodevice/downloadshtml - - - = 75 V ~ 9 V DC (HD1320/1320E), 5V DC ±10% (HD1321) - = 150mA - = 0 ~ 95% - = 5 ~ 55 HelloDevice 137-130 210 : (02) 573-7772 : (02) 573-7710 : support@senacom : http://wwwsenacom 5

HelloDevice 1320/1320E/1321 2 HD132x, RS232 TCP/IP, RS232 TCP/IP,, TCP/IP RS232 HD132x HD1320E/1320/1321, 21 RS232 TCP/IP, HD1320E HD1320, HD1321, DIP HD1320/HD1320E/HD1321 CPU Ubicom Sx52BD (8-Bit, 50 MIPS) 32 KB SRAM 10 Base-T (IEEE8023) 1 RS-232, 115 Kbps DHCP TCP IP / ICMP / ARP (IEEE8023) HelloDevice ( 95/98/NT/2000 ) : IP, 21 HelloDevice 132X 6

HelloDevice 1320/1320E/1321 3 31 HD1320/HD1320E HD1320E 31 (a), (b), 32 Status LEDS Power Collision Rx Tx RJ-45 Connector To Ethernet Serial Connector (RS-232) Power Connection ( 75V ~ 9V DC ) 31(a) HD1320E 32 KB SRAM Ethernet Controller Microprocessor UART Status LEDS Power Collision Rx Tx RJ-45 Connector To Ethernet Serial Connector (RS-232) Power Connection ( 75V ~ 9V DC ) 31(b) HD1320/1320E 7

HelloDevice 1320/1320E/1321 RJ45 connector to Ethernet 10 Base-T filter Ethernet controller (10 Base-T) Sx52BD microprocessor 32 KB RAM Power supply 1 serial port RS232 32 HD1320 311 = 75 V ~ 9V DC = 150mA 312 HelloDevice RJ45, 100m (1),,, : RealTek Full-duplex : RTL8019AS IEEE8023 10Base-T NE2000 8

HelloDevice 1320/1320E/1321 (2) RJ45 AT&T258 Shield 1=Tx+ 2=Tx- 7=NC 8=NC Pin 1 Tx+ White with orange 2 Tx- Orange 3 Rx+ White with green 4 Not used Blue 5 Not used White with blue 6 Rx- Green 7 Not used White with brown 8 Not used Brown 3=Rx+ 6=Rx- 4=NC 5=NC 33 RJ45 (3) LED LED Tx, Rx, Collision, Power LED 4 ( 31), Power LED HelloDevice ON Rx LED / Tx LED HelloDevice 1 /,, ping PC / Collision LED, 9

HelloDevice 1320/1320E/1321 313 RS232 RS232 DB9 150bps ~ 115Kbps 3=TxD 2=RxD 4=NC 1=NC 5=GND 6=NC 9=NC 7=RTS 8=CTS Pin 1 NC Not connected - 2 RxD Receive Data Data Input 3 TxD Send Data Data Output 4 NC Not connected - 5 GND Signal Ground - 6 NC Not connected - 7 RTS Ready To Send Handshake Output (+12V=Ready to Rx, -12V=Not Ready to Rx) 8 CTS Clear To Send Data sent 9 NC Not connected Data sent only at +3V ~ 12V 34 HelloDevice DSUB 10

HelloDevice 1320/1320E/1321 32 HD1321 HD1321 35, 36 Rear side 10BaseT Ethernet Chip microprocessor UART External interface Ethernet interface Power Connection ( 5V DC ) TTL RS232 interface 32 KB SRAM 35 HD1321 32 KB SRAM Ethernet controller (10 Base-T) Sx52BD microprocessor Ethernet RS232 Interface Power supply 36 HD1321 11

HelloDevice 1320/1320E/1321 321 = 5 V DC ±10% = 150mA 322 HD1321,, UART, JP1, JP2 20 37, 31 HD1321 # 1 GND 2 Reset System Reset Low Active JP1 3 ~ 5 LED2 ~ LED0 LED LED0: Tx, LED1: Rx, LED2: Collision 6 TPOut- TPOut- 7 TPOut+ TPOut+ JP2 8 TPIn+ TPIn+ 9 TPIn- TPIn- 10 Vcc 5V 1 Vcc 5V 2 NC 3 DSR RS232 Data Set Ready 4 CTS RS232 Clear To Send 5 DTR RS232 Data Terminal Ready 6 RTS RS232 Ready To Send 7 RxD RS232 Data Input 8 TxD RS232 Data Output 9 NC 10 GND TTL Level 31 HD1321 12

HelloDevice 1320/1320E/1321 GND Reset LED2 LED1 LED0 TPOut- TPOut+ TPIn+ TPIn- Vcc 1 2 3 4 5 6 7 8 9 10 JP1 1 2 3 4 5 6 7 8 9 10 JP2 Vcc NC DSR CTR DTR RTS RxD TxD NC GND 37 HD1321 13

HelloDevice 1320/1320E/1321 33 4 KWORD, (OSI : Open System Interconnection) TCP/IP RS232 32, OSI 7 HelloDevice 7 Application RS232 DHCP 6 Presentation 5 Session 4 Transport 3 Network TCP UDP 2 Data link IP / ICMP ARP 1 Physical layer (IEEE8023) 32 OSI 7 HelloDevice 132X 14

HelloDevice 1320/1320E/1321 4 HelloDevice (1) HelloDevice (2) HelloDevice (3) HelloDevice IP (4) HelloDevice 41 PC HelloDevice CD-ROM \HD_UTILITY\HD1x20 setup132xexe Setup132xexe 95/98/ME/ NT/2000 [setup type] [Complete] [Custom] [Next] 41 HelloDevice [Complete], Program Files\sena\HelloDevice Utility_HD1320\ [Custom] 15

HelloDevice 1320/1320E/1321 42(a) [Custom setup] 42(b) [Change] 16

HelloDevice 1320/1320E/1321, 42 (a), (b) [Custom] [Change], HelloDevice, HelloDevice 43 HelloDevice 17

HelloDevice 1320/1320E/1321 42 HD1320/1320E,, RS232, 1320E 421 HD1320/1320E (1) 75V ~ 9V DC HD1320E 110/220 V 75V HD1320E 44 HD1320E 75V (2) RJ45 HD1320E (HD1320E RJ45 3 ) 110/220 V Ethernet backbone 75V HD1320E 45 HD1320E (3) HD1320E LED Tx LED 1 / 31 [ LED] ) 18

HelloDevice 1320/1320E/1321 422 HD1321 HD1321 DIP, HD1321,, RJ45 46 HD1321 46 HD1321 19

HelloDevice 1320/1320E/1321 43 431 IP HD132x 10BaseT, 47 HelloDevice - IP IP - IP HD132x DHCP, IP DHCP(Dynamic Host Configuration Protocol) HelloDevice IP DHCP(RFC2131) 20

HelloDevice 1320/1320E/1321 HelloDevice IP 0000, HelloDevice DHCP IP, HelloDevice Tx LED ( 31 [ LED] ) (1) DHCP DHCP HelloDevice IP, DHCP IP, Tx LED, HelloDevice IP (2) HelloDevice DHCP, DHCP HelloDevice DHCP HelloDevice IP IP, IP HelloDevice MAC 1 -IP IP HelloDevice IP IP, IP 1 MAC,, 6 byte HelloDevice MAC MAC 00-01-95 xx-xx-xx ) 00-01-95-01-aa-08, 00-01-95-01-02-01 21

HelloDevice 1320/1320E/1321 HelloDevice IP 47 HelloDevice IP (1) PC HelloDevice, [IP Address] [IP Address] DHCP IP ([DHCP Start], [DHCP Stop]), IP ([IP Find]) ([IP Clear]) (2) [Server Setting], DHCP HelloDevice DHCP [Router] IP IP 48 DHCP DHCP Server IP PC IP 22

HelloDevice 1320/1320E/1321 48 DHCP (3) [Add], DHCP 49 DHCP HelloDevice MAC IP MAC type MAC length HelloDevice, 1 6 MAC Address HelloDevice IC 49, MAC 00:01:95:04:0B:1B, HelloDevice IP 192168115 [Default Router], 48 DHCP 23

HelloDevice 1320/1320E/1321 Router IP (4) [Add], (2) IP (5) [DHCP start], DHCP [DHCP start] HelloDevice Utility Program DHCP Server [Status] Monitoring Listening DHCP request DB List HelloDevice IP [Status] Listening DHCP request " DHCP ACK sent [ 192168 115 ]" HelloDevice DB List HelloDevice Utility Program "DB Setting for DHCP" IP IP HelloDevice IP (6) HelloDevice TX LED HelloDevice IP, HelloDevice IP, [Status] DHCP ACK sent [ 192168 115 ] HelloDevice TX LED /, IP, [Status] DHCP ACK sent [ 192168 115 ], HelloDevice IP DHCP IP, It was Request to other DHCP server! Packet Discarded (7) ping, HelloDevice IP ping Command prompt, ping >> ping 192168115 >> Pinging 192168115 with 32 bytes of data: Reply from 192168115: bytes=32 time=10ms TTL=251 Reply from 192168115: bytes=32 time<10ms TTL=251 Reply from 192168115: bytes=32 time=10ms TTL=251, IP, (5), (6), (7) (8) [IP Find], HelloDevice IP 24

HelloDevice 1320/1320E/1321 [ IP Find], 410 HelloDevice MAC, [Find], Found IP IP 410 [IP Find] IP, [more], [System info], HelloDevice 411 [System Info], 41 25

HelloDevice 1320/1320E/1321 411 [System info] Group HellDevice Info TCP COM Client info TCP COM Server info MAC Address MAC IP Address IP Base TCP Port # TCP Current TCP Port # TCP Current TCP State TCP TCP State timer TCP State Power-ON timer IP setup mode IP TCP mode setup TCP Current TCP mode TCP Default Router IP MAC Address HD Server Client MAC IP Address HD Server Client IP TCP Port # HD Server Client MAC Address IP Address HD Server MAC HD Server IP HelloDevice Server Server/Client Mode HelloDevice Client Server/Client 26

HelloDevice 1320/1320E/1321 info TCP Port # HD Server 41 [System Info] Mode Note: 1) [IP Find], [IP Find] HelloDevice 441 2) [IP Find] LAN(Local Area Network), 432 IP IP, IP 0000 431 IP, IP, IP 192168115 192168118, IP (1) MAC IP 192168115 0000, IP HelloDevice MAC HelloDevice MAC HelloDevice, DHCP (2) IP [IP Address] [IP Clear], IP 412 HelloDevice MAC, [Clear] IP 192168115 HelloDevice IP 0000 Note: IP Mode Dynamic IP [IP Clear] IP Dynamic IP IP IP Mode 442 27

HelloDevice 1320/1320E/1321 412 IP Clear (3) IP HelloDevice TX LED IP, IP, HelloDevice TX LED / Note: DHCP, HelloDevice IP [Dynamic-IP], DHCP IP, TX LED IP 44 (4) IP IP 192168118, DHCP [Edit] IP /, 431 IP 28

HelloDevice 1320/1320E/1321 413 DHCP [Edit] IP 44 HD132x RS232 TCP/IP [Network Mode] Serial Interface [Serial], Parameter [Password] 414 Parameter (1) Password HelloDevice MAC IP Note: Parameter MAC LAN HelloDevie 29

HelloDevice 1320/1320E/1321 MAC Destination IP 255255255255 Parameter (WAN ) HelloDevice Parameter HelloDevice MAC Destination IP HelloDevice IP (2), [Send] [Send], HelloDevice,, 441 [Password], 1) HelloDevice, HelloDevice, ID : AAAAAAAA Password : AAAAAAAA,, 415, [Send] 415 30

HelloDevice 1320/1320E/1321 416, 416, [Change] Combo box,, [Send] 417 418 ID GOSENA00 HelloDevice 417 418 31

HelloDevice 1320/1320E/1321 HelloDevice ID / Password 8, / / ID / Password PWDini MAC, ID / Password [IP Clear], [IP Find], [Network mode], [Serial], [ID/Password / ],, Note: PWD 442 Network Mode 419 Network Mode HelloDevice MAC IP TCP TCP TCP (TCP ) TCP IP (TCP ) HelloDevice TCP/IP System info System info 419, HelloDevice HelloDevice TCP 32

HelloDevice 1320/1320E/1321 (1) IP Mode Static IP IP, IP, IP, [IP Clear] IP 432 IP Dynamic IP Dynamic IP,, DHCP IP DHCP IP DHCP, HelloDevice 24 DHCP IP, Dynamic IP, 24 IP Note: Dynamic IP [IP Clear] IP (2) Device Comm Server Mode TCP HelloDevice Port TCP, HelloDevice, TCP/IP HelloDevice RS232 HelloDevice TCP, TCP TCP TCP, TCP Client Mode HelloDevice RS232 TCP HelloDevice 1 5 Server & Client Mode HelloDevice TCP HelloDevice TCP TCP IP, TCP, TCP, Note: 33

HelloDevice 1320/1320E/1321 HD PORT RS232 TCP TCP, HelloDevice TCP TCP, 2000 ~ 65535 Server IP, Server PORT Server IP Server PORT HelloDevice TCP, HelloDevice, TCP IP 2000 ~ 65535 HelloDevice TCP (3) Notifier HelloDevice [Time Interval] IP IP HelloDevice, HelloDevice Dynamic IP, TCP (DHCP, TCP ), Dynamic IP, IP 24, HelloDevice IP, HelloDevice IP PC HelloDevice UDP 53 6, 6, [Time Interval] 1 30 443 RS232 RS232 HelloDevice RS232 420 RS232 [Serial] baud rate 150, 300, 600, 900, 1200, 2000, 2400, 3600, 4800, 7200, 9600, 19200, 38400 parity None, Even, Odd Data bits 5, 6, 7, 8 bits 34

HelloDevice 1320/1320E/1321 Stop bits 1, 1½, 2 bit handshake Œ Time None, H/W, X On/Off RS232, TCP/IP, 4, 100, Unlimited 420 [Serial], MAC 00:01:95:04:0B:1B, 9600 baud rate, Parity None, Data bit 8, Stop bit 1, Handshake None, Time 50 420 RS232 35

HelloDevice 1320/1320E/1321 5, TeraTerm Pro, HyperTerminal, Telnet RS232-TCP/IP, HelloDevice PC,, HelloDevice Dynamic IP, TCP, IP, TeraTerm Pro 51 HD1320E RS232 PC TCP/IP, RS232 1) PC RS232 HelloDevice RS232 RS232 3 Ethernet backbone TCP/IP TCP/IP HelloDevice 192168118 192168124 HD PORT 6001 RS232 (COM1 COM2) RS232 51 RS232-TCP/IP 36

HelloDevice 1320/1320E/1321 2) HelloDevice, HelloDevice TCP RS232 443 9600 baud rate Parity None Data bit 8 Stop bit 1 Handshake None, Time 50 3) PC RS232, TeraTerm Pro COM2 4) Tera term Pro COM2, HelloDevice RS232 52 TeraTerm RS232 5) [OK], 37

HelloDevice 1320/1320E/1321 6) PC TCP/IP 7) HelloDevice IP TCP TCP/IP 53 TCP/IP TCP/IP 8) TCP/IP, RS232 RS232, TCP/IP 54 TCP/IP RS232 Note: HelloDevice RS232 [Time] RS232 Hello Device TCP/IP, 2) 50 TCP/IP 38

HelloDevice 1320/1320E/1321 54 HelloDevice / 52 HelloDevice TCP/IP, 51 - HelloDevice TCP ( 51 Server ) - HelloDevice TCP ( 51 Client ) - HelloDevice ( 51 UDP Server ) 55 HelloDevice 39

HelloDevice 1320/1320E/1321, Visual C/C++ 60, (*dsw), Visual C/C++ 60 521 TCP, HelloDevice 51 TCP, HelloDevice, TCP/IP, 51, HelloDevice TCP 1) 51, HelloDevice RS232 PC RS232, RS232 2) Server Serverdsw Open Build, Run 3) HelloDevice IP 56 HelloDevice IP 192168115 56 40

HelloDevice 1320/1320E/1321 4), [Enter] PC RS232 TCP, TCP, TCP/IP, socket, connect, send //--------------------------------- // Process Serial data send //--------------------------------- void SerialSend() { char commandbuf[512]="" ; int commandlen ; int err ; // Re-Initialize TCP socket TCPSocketInit() ; // Read serial data //: just ASCII string excluding control characters //: Max size is limited to 512 bytes in this demo printf("\nenter the string you want to send to HelloDevice\n>>") ; scanf("%s", commandbuf) ; // Calc serial data length commandlen = strlen(commandbuf) ; // Send command to HelloDevice err = sendto ( sock, &commandbuf, commandlen, 0, (struct sockaddr*)&serveraddr, sizeof(serveraddr) ) ; if (err == -1 ) { perror("\nsend error\n"); exit (1); //-------------------------------- // Initialize TCP socket //-------------------------------- void TCPSocketInit() { char ipaddrstr[32] ; 41

HelloDevice 1320/1320E/1321 int clientlen ; int err ; // Enter HelloDevice IP address printf("enter HelloDevice IP address(xxxxxxxxxxxx) : ") ; scanf("%s", ipaddrstr) ; printf("\n\n") ; // Convert IP address from string to long ipaddr = decodeaddress(ipaddrstr) ; // Windows requires that winsock be initialized err = WSAStartup (0x0101, &lpwsadata); if ( err!= 0 ) { printf("\ncannot open WinSock???\n"); exit (1) ; else printf("1) WinSock Opened\n") ; // Create TCP socket clientlen = sizeof(serveraddr); sock = socket(af_inet, SOCK_STREAM, 0); if ( sock < 0 ) { perror("\nsocket error???\n"); exit (1) ; // Clear IP address fields memset( (char*) &addr, 0, sizeof( addr ) ); memset( (char*) &serveraddr, 0, sizeof( serveraddr ) ); // Set my IP address : TCP port 6001 addrsin_family = AF_INET; // You may use any port other than 6001 in host side! addrsin_port = htons(6001); addrsin_addrs_addr = INADDR_ANY; // Set HelloDevice IP address : TCP port 6001 serveraddrsin_family = AF_INET; serveraddrsin_port = htons(6001); printf("\tby Using port %d on the HelloDevice\n", ntohs(serveraddrsin_port) ); serveraddrsin_addrs_addr = htonl(ipaddr); // Connecting to HelloDevice err = connect( sock, (struct sockaddr*) &serveraddr, sizeof(serveraddr) ); if ( err == -1 ) { perror("\ncannot connect to HelloDevice???\n"); exit (1) ; printf("2)connected to HelloDevice, %d port\n", ntohs(serveraddrsin_port) ); 42

HelloDevice 1320/1320E/1321 //------------------------------ // Close TCP socket //------------------------------ void TCPSocketClose() { closesocket(sock) ; 522 TCP 51, HelloDevice TCP, TCP, TCP IP, HelloDevice TCP, RS232 HelloDevice, HelloDevice IP,,, HelloDevice, HelloDevice RS232, RS232, RS232 PC, RS232 HelloDevice, 1) 51, HelloDevice RS232 PC RS232, RS232 2) HelloDevice [Network Mode] [TCP mode] [Client], [Server IP, PORT] PC IP, 6001, 521 57 PC IP 1921681111, [Send] HelloDevice TCP, HelloDevice RS232 IP 1921681111 TCP 6001, HelloDevice RS232 43

HelloDevice 1320/1320E/1321 57 HelloDevice TCP 3) HelloDevice [Serial] [Serial Time Unlimited], HelloDevice TCP, RS232 TCP 58, Serial Time Unlimited, [Send] HelloDevice TCP, TCP 44

HelloDevice 1320/1320E/1321 58 HelloDevice [Serial] 4) Client Clientdsw Open Build, Run 5), RS232 [Received Data], HelloDevice, RS232 59 listen, bind, accept, socket, recv, sendto,, 521 //---------------------------------------- 45

HelloDevice 1320/1320E/1321 // Process listening : ProcessRecv called //---------------------------------------- void ProcessListen() { int clientlen; char chdumm; clientlen = sizeof(addrclient); memset((char*) &addrclient, 0, sizeof(addrclient)); while (1) { //------------------------------------------------------------ // accept an incoming connection attempt on the server socket //------------------------------------------------------------ sockclient = accept(sock,(lpsockaddr)&addrclient,&clientlen); if (sockclient == INVALID_SOCKET) { printf("\naccept error???\n"); printf("\nplease, try later(press ENTER)"); scanf("%c", &chdumm); break; else { printf("connected from client[%d%d%d%d]\n",addrclientsin_addrs_uns_un_bs_b1,addrclientsin_addrs_uns_un_bs_b2,addrclientsin_addrs_uns_un_bs_b3,addrclientsin_addrs_uns_un_bs_b4); //--------------------------------------------------------- // receives data from the client socket(hd1320) //--------------------------------------------------------- if(processrecv()) { // Exit Program break; else { // Continue Listen // Just close the client socket TCPSocketClose(CLOSE_CLIENT_SOCKET); memset((char*) &addrclient, 0, sizeof(addrclient)); //---------------------------------------------- // Process receive : socket recv function called // return 9 : exit program // 0 : continue listening //---------------------------------------------- int ProcessRecv() { char bufreceived[bufsize]; int ncountreceived = 0; int ncommand = 0; int nshowmenu = 0; memset(bufreceived,'\0',sizeof(bufreceived)); while(1) { //--------------------------------------------------------- // receives data from a connected socket(hd1320) //--------------------------------------------------------- ncountreceived = recv(sockclient,bufreceived,sizeof(bufreceived),0); if (ncountreceived == 0) { // HelloDevice closed the client socket printf("disconnected from client[%d%d%d%d]\n",addrclientsin_addrs_uns_un_bs_b1 46

HelloDevice 1320/1320E/1321,addrClientsin_addrS_unS_un_bs_b2,addrClientsin_addrS_unS_un_bs_b3,addrClientsin_addrS_unS_un_bs_b4); DisplayMenu(); scanf("%d", &ncommand); return ncommand; else if (ncountreceived < 0) { if (++nshowmenu == SHOWMENU) { DisplayMenu(); scanf("%d", &ncommand); return ncommand; else { continue; else { // received some data // Send echo to client if(!serialsend(bufreceived, ncountreceived)){ // Sending echo error printf("fail to send echo to client[%d%d%d%d]\n",addrclientsin_addrs_uns_un_bs_b1,addrclientsin_addrs_uns_un_bs_b2,addrclientsin_addrs_uns_un_bs_b3,addrclientsin_addrs_uns_un_bs_b4); DisplayMenu(); scanf("%d", &ncommand); return ncommand; printf("[received Data]%s\n", bufreceived); ncountreceived = 0; nshowmenu = 0; memset(bufreceived,'\0',sizeof(bufreceived)); //---------------------------------------- // Process sending serial data to HelloDevice // return : 1 - success, 0 - failure //---------------------------------------- int SerialSend(char* strreceived, int nreceived) { int err; char* pcommandbuf = (char*)malloc(nreceived + 2); memcpy(&pcommandbuf[0], strreceived, nreceived); // Send command to HelloDevice err = sendto ( sockclient, pcommandbuf, nreceived + 2, 0, (struct sockaddr*)&addrclient, sizeof(addrclient) ) ; free(pcommandbuf); if (err == -1 ) { return 0; return 1; 47

HelloDevice 1320/1320E/1321 //---------------------------------- // Initialize TCP server socket // return : 1 - success, 0 - failure //---------------------------------- int TCPServerSocketInit() { char chdummy; int err ; //----------------------------------------------------- // Initiate use of WS2_32DLL by a process //----------------------------------------------------- err = WSAStartup (0x0101, &lpwsadata); if ( err!= 0 ) { printf("\nfail to start up winsock???\n"); scanf("\nplease, try later(press ENTER)"); scanf("%c", &chdummy); return 0; else printf("winsock Opened\n") ; //----------------------------------------------------- // create a server socket //----------------------------------------------------- sock = socket(af_inet, SOCK_STREAM, 0); if ( sock < 0 ) { printf("\nsocket error???\n"); printf("\nplease, try later(press ENTER)"); scanf("%c", &chdummy); return 0; printf("server socket created\n") ; // Clear server IP address fields memset( (char*) &addr, 0, sizeof( addr ) ); // Set server IP address : TCP port 6001 addrsin_family = AF_INET; // You may use any port other than 6001 in host side! addrsin_port = htons(6001); addrsin_addrs_addr = INADDR_ANY; //----------------------------------------------------- // associate a local address with a socket //----------------------------------------------------- if(bind(sock,(lpsockaddr)&addr,sizeof(addr)) == SOCKET_ERROR) { printf("\nserver socket bind error???\n"); scanf("\nplease, try later(press ENTER)"); scanf("%c", &chdummy); return 0; printf("server socket bound\n") ; //----------------------------------------------------- // places a socket a state where it is listening for an // incoming connection 48

HelloDevice 1320/1320E/1321 //----------------------------------------------------- if(listen(sock,5) == SOCKET_ERROR) { printf("\nserver socket listen error???\n"); scanf("\nplease, try later(press ENTER)"); scanf("%c", &chdummy); return 0; printf("server socket listening for an incoming connection\n"); return 1; //------------------------------------------------------------------ // Close TCP socket // parameter //bcloseonlyclient : CLOSE_CLIENT_SOCKET(1) - close just client socket //CLOSE_ALL_SOCKET(0) - close all socket and clean up //------------------------------------------------------------------ void TCPSocketClose(int bcloseonlyclient) { //----------------------------------------------------- // close the client socket //----------------------------------------------------- if (sockclient!= INVALID_SOCKET) { closesocket(sockclient); sockclient = INVALID_SOCKET; if (!bcloseonlyclient) { //----------------------------------------------------- // close the server socket //----------------------------------------------------- closesocket(sock); //----------------------------------------------------- // terminate use of the WS2_32DLL //----------------------------------------------------- WSACleanup(); 523 HelloDevice Dynamic IP, TCP,, HelloDevice IP HelloDevice Dynamic IP, IP, HelloDevice IP, HelloDevice IP, HelloDevice IP IP, UDP (User Datagram Protocol), HelloDevice IP, HelloDevice Dynamic IP HelloDevice, HelloDevice, HelloDevice 49

HelloDevice 1320/1320E/1321 IP, LAN, IP LAN HelloDevice, IP, UDP 514 MAC, Local Port, IP IP 442 HelloDevice 14 OK (2 Byte)+ MAC (6 Byte) + Local Port(2 Byte) + IP (4 Byte) HelloDevice /************************************************************************** UDP-based data server sample program HelloDevice notifying message format : total 14 bytes data : The number in the parenthisis means the byte size 'O'(1)+'K'(1)+ MAC address(6) + local port number(2) + IP address(4) eg 4f-4b-00-01-95-04-04-01-17-71-c0-a1-a8-0f **************************************************************************/ #include <stdioh> #include <timeh> #include <winsockh> // Global Variable definition WSADATA lpwsadata; // Socket data structure SOCKADDR_IN addrfrom; int sock ; // Socket int byte_received ; // byte received struct sockaddr_in addr ; // My IP address // UDP Socket function void UDPSocketCreate() ; void UDPSocketRun() ; void UDPSocketClose() ; // Main function void main() { printf("udp Hello Device Program \n"); // 1) Socket Creation UDPSocketCreate() ; while(1) { 50

HelloDevice 1320/1320E/1321 // 2) Listen until any incoming data // 3) Receive if any incoming data // 4) Print data UDPSocketRun(); // 5) Close UDP Socket UDPSocketClose() ; //--------------------- // UDP Socket Creation //--------------------- void UDPSocketCreate() { // Windows requires that winsock be initialized if (WSAStartup (0x0101, &lpwsadata) == INVALID_SOCKET) { printf("\ncannot open WinSock???\n"); exit (1) ; else printf("winsock Openedwaiting\n") ; // Create Windows socket for UDP sock = socket(af_inet, SOCK_DGRAM,0); if (sock < 0) { perror("\nsocket error???\n"); exit (1) ; // Setupo the port configuration // UDP port : 514 addrsin_family = AF_INET; addrsin_port = htons(514); addrsin_addrs_addr = htonl(inaddr_any); // Launch UDP socket if (bind(sock,(lpsockaddr)&addr,sizeof(addr)) == SOCKET_ERROR) { printf("\n Socket error program terminated\n " ); exit(1); //--------------------- // UDP Socket Run //--------------------- void UDPSocketRun() { int naddrfromlen = sizeof(addrfrom); IN_ADDR infrom; char test_buff[300]; char dbuffer [9]; char tbuffer [9]; int i ; // Wait until it receives data byte_received = 51

HelloDevice 1320/1320E/1321 recvfrom(sock,test_buff,250,0,(lpsockaddr)&addrfrom,&naddrfromlen); if (byte_received==socket_error) { printf("\n Socket error program terminated\n"); exit(1); memcpy(&infrom, &addrfromsin_addr,4); // Calculate date & time _strdate( dbuffer ); printf( "\n Info was notified on %s ", dbuffer ); _strtime( tbuffer ); printf( "%s \n", tbuffer ); // Decode the incoming datagram printf("\n from %s \n\n MAC address: ", inet_ntoa(infrom) ); for(i=2; i<8; i++) printf("%2x ",(unsigned char)test_buff[i]); printf("\n Port # :"); for(i=8;i<10;i++) printf("%3x",(unsigned char)test_buff[i]); printf(" \n IP address :"); for(i=10;i<14;i++) printf(" %3d ",(unsigned char)test_buff[i]); printf("\n \n \n \n"); //--------------------- // UDP Socket Close //--------------------- void UDPSocketClose() { closesocket(sock); Visual C/C++ console application, 510 HelloDevice 52

HelloDevice 1320/1320E/1321 510 6 RS232-TCP/IP 61 TCP PC HelloDevice RS232, PC HelloDevice, RS232 TCP RS232 HelloDevice TCP [Client], RS232 HelloDevice TCP/IP TCP, TCP/IP RS232 HelloDevice TCP [Server] RS232, PC TCP/IP 53

HelloDevice 1320/1320E/1321 HelloDevice RS232, HelloDevice TCP/IP PC HelloDevice TCP [Server/Client], TCP, TCP, RS232,,, [Server] [Client], 611 TCP HelloDevice TCP TCP HelloDevice TCP/IP HelloDevice TCP,, TCP, RS232, TCP, TCP ( 32KB) TCP, RS232 IP, [RS232 ], TCP, TCP, TCP (Socket Close) 612 TCP HelloDevice TCP TCP HelloDevice TCP/IP TCP, HelloDevice TCP HelloDevice TCP, RS232 54

HelloDevice 1320/1320E/1321, TCP RS232, TCP, 5, RS232, TCP TCP,, [RS232 ],, TCP TCP, HelloDevice RS232, TCP (Socket Close) 613 TCP / HelloDevice TCP TCP HelloDevice TCP/IP TCP, TCP, RS232, TCP, TCP, RS232,,, 611 612 62 RS232 61 RS232 9 Pin 1 Received Line Signal Detector (Data Carrier Detect) Pin 2 Received Data Pin 3 Transmit Data Pin 4 Data Terminal Ready Pin 5 Signal Ground Pin 6 Data Set Ready Pin 7 Request To Send Pin 8 Clear To Send DCD RxD TxD DTR GND DSR RTS CTS 55

HelloDevice 1320/1320E/1321 Pin 9 Ring Indicator RI 61 RS232 9 HelloDevice RS232, HD1320/1320E RxD, TxD RS232 RTS, CTS, DTR, DSR, DTR, DSR, 61 RS232 1(DCD), 4(DTR), 6(DSR), RTS, CTS HelloDevice 3=TxD 2=RxD 5=GND 7=RTS 8=CTS HelloDevice HelloDevice RxD RxD RxD RxD TxD TxD TxD TxD GND GND GND GND RTS RTS RTS RTS CTS CTS CTS CTS DTR DTR DTR DTR DSR DSR DSR DSR DCD DCD DCD DCD (a) (b) 61 HD1320/1320E RS232 HD1321, RS232 5V TTL,, RXD, TXD, RTS, CTS, DTR, DSR 56