Rockwell Automation 1771-DMC_DMC1_DMC4_DXPS Control Coprocessor User Manual User Manual

Page 102

Advertising
background image

Chapter 6

Using the Ethernet Interface

6-21

The following flow chart shows a client/server interface.

socket()Ċcreatesa

communication socket

bind()Ċtiesa name/address

structure to socket

listen()Ċestablishes socket as

a server, sets number simultaneous

connectionsallowed

accept()Ċwaits for client to establish

connection, createsnew socket for

client use, old socket waits for next

connect ( )

recv() or send()Ċtransfer of data

and perform server stuff"

shutdown()Ċdisallows

further transfers

Server Program

socket()Ċcreatesa

communication socket

get host by nameĊlooksup

server's IP address in hosts"

given hostname

get serv by nameĊlooksup

wellĆknown servce number"

in services" given name

connect()Ċestablishes connection

to server (which must already be

waiting with accept ( ))

send() or recv() or do client

stuff" until done with service

close()Ċterminate existence of

socket data path

Client Program

exit()Ċdone!

close()Ċterminate existence

of socket acquired from

accept()

data transfer and

agree when done

establish connection

exit if we did fork() above

wait

for

next

client

(see note)

Note: fork() for multiĆconnect service

Refer to the OS-9 Internet Software Reference Manual, publication
1771-6.4.11, Appendix B, for example programs. Each of the three
different examples provide client and server programs using TCP sockets.

Advertising