Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- NetLib for Clipper, Version 6.0 - n_spxlisten() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
N_SPXLISTEN()


Returns

Non-zero SPX connection number.

Zero if no attempt to make a connection is detected.


Description

This function can be called periodically to check for incoming requests
to connect with the current station. Once an incoming connection has
been established, use N_SPXRECV() to receive the transmission. After a
transmission is complete, you should reissue N_SPXLISTEN() to check for
additional requests, if desired.

It is not necessary to call this function to receive IPX
messages.Periodic checking for connection requests may not be
appropriate for some applications. An alternative is to set an event
trap with N_ONSPX(), which will call a user-defined procedure whenever
a request for an SPX connection is received.


Example

LOCAL nConnection, cBuffer, cNetAddr
// Accept remote connections
nConnection = 0
DO WHILE nConnection = 0
   nConnection = N_SPXLISTEN()
ENDDO

// Receive a message
DO WHILE N_SPXRECV() != 0
ENDDO
N_SPXRECV(@cBuffer, @cNetAddr)
.
.
.
// Send a message to the same station
cBuffer = 'Same to you, Jack.'
IF 'A' $ N_SPXSTATUS(nConnection)  // Connection active?
   N_SPXSEND(nConnection, cBuffer)
ELSE                               // If not, connect.
   nConnection = 0
   DO WHILE nConnection = 0
      nConnection = N_SPXCONNECT(cNetAddr)
   ENDDO
   N_SPXSEND(nConnection, cBuffer)
ENDIF



See Also: N_ONSPX() N_SPXRECV()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson