AMC 68VZ328 Frozen Dessert Maker User Manual


 
86
www.amctechcorp.com
Simple Server & Client
T
he sample programs server.c and client.c are available in the SDK samples directory,
/opt/user_code/networking/filetransfer/without_inetd. The programs interact using
Internet sockets, AF_INET. Once the sockets have been established they can be read from and written to in
order to transfer information. Each program will be run on a separate NETdimm, and using the IP addresses
established during configuration, text files such as hello.txt can be transferred between them.
The server will set up its own socket and wait for an incoming client socket. Upon accepting a client connec-
tion, it will set up a client socket, and go through a series of read and write operations on the socket to accept
the file transfer.
On the client side, it will set up a socket and then attempt to connect to a server. Once a connection has been
established the socket will be used for reads and writes to the server to transfer the file.
Note that the port that the client and server sockets will connect through must be the same. It has been hard
coded in the program during the socket setups.
Inetd based Server & Client
The sample programs inetServer.c and inetClient.c are available in the SDK samples directory,
/opt/user_code/networking/filetransfer/with_inetd. These programs interact through
the internet daemon, inetd. Similar to the simple server and client programs, a text file can be transferred
between two NETdimms using the IP addresses established during configuration.
The following instructions must be added to the config files of the root file system of both NETdimm modules
for the inet based server and client to work. In /etc/services the service that needs to be called,
inetServer, must be added to the list in the format
service-name port/protocol
eg. inetServer 9735/tcp
The port number can be chosen arbitrarily, so long as it does not already exist in the services list and is not
below 1024, which are reserved for system use.
In /etc/inetd.conf the program and path that inetd will load must be added in the format
service-name endpoint-type protocol wait-status uid server-program server-
arguments
eg. inetServer stream tcp nowait root /usr/inetServer
The server side of the program is started by inetd, allowing the read and write operations to go to standard
input and output. inetd will listen on all service ports for the services listed in