Cross-platform TCP/IP Socket programming in REXX Contents
Cross-platform TCP/IP Socket programming in REXX Contents
Cross-platform TCP/IP Socket programming in REXX Contents
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Cross</strong>-<strong>platform</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Socket</strong> Programm<strong>in</strong>g <strong>in</strong> <strong>REXX</strong><br />
●<br />
●<br />
●<br />
Resolver, Port number<br />
<strong>Socket</strong> functions deal with <strong>IP</strong> addresses, not<br />
hostnames<br />
SockGetHostByName()<br />
● Converts a hostname to an <strong>IP</strong> address, by <strong>in</strong>terfac<strong>in</strong>g to the<br />
resolver on the local mach<strong>in</strong>e<br />
● Generally, the resolver communicates with one or more<br />
DNS servers<br />
● Use this to accept both <strong>IP</strong> addresses and/or hostnames<br />
Multiple servers on a mach<strong>in</strong>e are dist<strong>in</strong>guished by<br />
port number<br />
● Client and server MUST agree on the port number<br />
● Hard-code the port number <strong>in</strong> your program, or accept it as<br />
a parameter <strong>in</strong> both client and server<br />
19<br />
20<br />
Basic <strong>Socket</strong> Connection Functions<br />
● SockB<strong>in</strong>d(socket, address) PC/UNIX<br />
<strong>Socket</strong>('B<strong>in</strong>d', socket, address)<br />
MVS<br />
● Used by servers to reserve a port<br />
● SockAccept(socket, [address] ) PC/UNIX<br />
<strong>Socket</strong>('Accept', socket)<br />
MVS<br />
● Used by servers to wait for a client to make a connection<br />
● socket must have been previously bound<br />
● When a connection occurs, a new socket is returned, which<br />
is used for further communication with the client (orig<strong>in</strong>al<br />
socket rema<strong>in</strong>s open, wait<strong>in</strong>g for new connections)<br />
● SockConnect(socket, address) PC/UNIX<br />
<strong>Socket</strong>('Connect', socket)<br />
MVS<br />
●<br />
Used by clients to connect to a server<br />
10<br />
updated 17-Aprr-2005 Copyright © 2005 ProTech Professional Technical Services, Inc.