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

 Syntax:
 lpbyPacket = IPXPacketGet(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.

 The CA-Clipper name for this function is:
 IPXPktGet()

 Description:
 IPXPacketGet() retrieves the contents of an IPX packet received from
 another workstation. IPXPacketGet() should only be called after
 IPXSocketOpen() 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, IPXPacketGet() automatically calls IPXSocketOpen() to listen for
 other incoming packets.

 IPXPacketGet() has no way of knowing that an incoming packet has been
 received, so must be continually called to check for incoming packets.
 IPXPacketGet() 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( IPXSocketOpen(NOVDEFINT) = 0 )
    ? "Listening on IPX socket 21845"
    do while TRUE
       lpszPacket = IPXPacketGet(@lpwLength)
       if empty( lpszPacket )
          iKey = inkey(1)
          if iKey != 27
             loop
          else
             ? "Listen cancelled by user"
             exit
          endif
       else
          ? "Packet received :", lpszPacket
       endif
    enddo
    IPXSocketClose()
 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
 IPXPacketGet() 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
 IPXSocketOpen() is given an explicit socket number to listen on. To find
 the current listening socket, use IPXSocketNumberGet(). It is recommended
 to use the default socket number, unless another process on the workstation
 already has this socket open.

See Also: IPXInstalled() IPXSocketClose() IPXSocketOpen() IPXPacketSend() IPXSocketNumberGet()

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