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> ipxpktget()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 IPXPktGet()
------------------------------------------------------------------------------
 Purpose:
 Get a received IPX packet.

 Syntax:
 lpbyPacket = IPXPktGet(lpwLength)

 Parameters:
 lpwLength Pointer to variable to receive the length of the received
           packet (i.e. variable passed by reference).

 Returns:
 A character string or binary data of up to 512 bytes.

 Description:
 IPXPktGet() retrieves the contents of an IPX packet received from
 another workstation. IPXPktGet() should only be called after
 IPXSktOpn() has been called to listen for incoming packets.

 The packet contents can be up to 512 bytes in length and can contain
 anything from binary data to an ASCII message. If an incoming packet is
 received, IPXPktGet() automatically calls IPXSktOpn() to listen for
 other incoming packets.

 IPXPktGet() has no way of knowing that an incoming packet has been
 received, so must be continually called to check for incoming packets.
 IPXPktGet() returns a character string containing the data contents of
 the packet, or an empty string if no packet has been received or if an
 error has occurred. lpwLength will be set to the length of the received
 data.

 Example:
 // To listen on the default IPX socket ( 21845 ) and poll for
 // received packets.
 if( IPXSktOpn(NOVDEFINT) = 0 )
    ? "Listening on IPX socket 21845"
    do while TRUE
       lpszPacket = IPXPktGet(@lpwLength)
       if empty( lpszPacket )
          iKey = inkey(1)
          if iKey != 27
             loop
          else
             ? "Listen cancelled by user"
             exit
          endif
       else
          ? "Packet received :", lpszPacket
       endif
    enddo
    IPXSktCls()
 endif

 CA-Clipper 5.x example: To listen for an incoming packet on the default
 socket, and automatically display it on the screen by calling
 IPXPktGet() from inside an event function:

 if( IPXSktOpn() = 0 )
    IPXEventInit( "ONIPX" )
 endif

 // program carries on normally from here, until a packet
 // is received.

 // ONIPX() is automatically called by an incoming packet
 FUNCTION ONIPX()
 LOCAL lpszPacket, nlength
    nlength = 0                   //
 initialise
    lpszPacket = IPXPktGet(@nlength)
    ? "Packet received :", lpszPacket
 return NIL

 Notes:
 By default the listening socket is 21845 ( 0x5555 ) unless
 IPXSktOpn() is given an explicit socket number to listen on. 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() IPXSktOpn() IPXPktSnd() IPXSktNumGet()

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