Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Novlib 3.30 Online Reference - <b> ipxsktopn()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 IPXSktOpn()
------------------------------------------------------------------------------
 Purpose:
 Open an IPX socket and listen for packets.

 Syntax:
 niSocket = IPXSktOpn( iSocket )

 Parameters:
 iSocket The socket number.

 Returns:
 A numeric value (signed short int).

 Description:
 IPXSktOpn() opens a socket specified by iSocket and if the socket is
 opened successfully it sets up a listen to receive any incoming packets
 from another workstation.

 IPXSktOpn() immediately returns so that the program can carry on, while
 the IPX socket listens for incoming packets in the background. If iSocket
 is specified as the constant value NOVDEFINT, IPXSktOpn() uses the
 default socket 21845 (0x5555). IPXSktOpn() returns 0 if it is already
 listening or NOVERRINT if an error occurs.

 Example:
 // To open IPX socket 17767 ( 0x4567 ), listen for 30 seconds
 // for an incoming packet and close the socket when a packet is received,
 // or when the 30 seconds has run out, or when the request is cancelled
 // by the user:
 iCounter = 30
 iPacketLength = 0
 if( IPXSktOpn( 17767 ) = 0 )
    ? "Listening on IPX socket 17767"
    do while ( (iCounter--) > 0 )
       lpszPacket = IPXPktGet(@iPacketLength)
       if empty( lpszPacket )
          iKey = inkey(1)
          if iKey != 27
             loop
          else
             ? "Listen Cancelled by user"
             exit
          endif
       else
          ? "Packet received :", lpszPacket
          exit
       endif
    enddo
    if( iCounter = 0 )
       ? "Ran out of time"
    endif
    IPXSktCls()
 endif

 Notes:
 To find the current listening socket, use IPXSktNumGet(). It
 is recommended to use the default socket number, unless another process on
 the workstation already has this socket open.

See Also: IPXInstalled() IPXSktCls() IPXPktGet() IPXPktSnd() IPXSktNumGet()

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