On Tue, 14 Oct 2008, Alex Strickland wrote:

Hi Alex,

> Sockets appear to me to be reliable in Harbour but I think Przemek has 
> alluded to problems with them? I don't know what they are. I know ADS uses 
> UDP, I'm not sure why.

Now the biggest problem is lack of C level API and some missing
functionality. It also should be changed to cover some small differences
and behavior strictly related to OS. Below is proposition for Harbour inet
API. I created this list some time ago but so far I haven't time to finish
implementation.

best regards,
Przemek


void     hb_socketInit( void );
void     hb_socketCleanup( void );

PHB_ITEM hb_socketNew( int iTimeOut );
int      hb_socketClose( PHB_ITEM pSocket );
FHANDLE  hb_socketHandle( PHB_ITEM pSocket );
int      hb_socketStatus( PHB_ITEM pSocket );
int      hb_socketErrorCode( PHB_ITEM pSocket );
char *   hb_socketErrorDesc( PHB_ITEM pSocket );
void     hb_socketClearError( PHB_ITEM pSocket );
int      hb_socketCount( PHB_ITEM pSocket );
char *   hb_socketAddress( PHB_ITEM pSocket, char * szHostIP );
int      hb_socketPort( PHB_ITEM pSocket );
int      hb_socketGetTimeOut( PHB_ITEM pSocket );
int      hb_socketSetTimeOut( PHB_ITEM pSocket, int iTimeOut );
int      hb_socketGetTimeLimit( PHB_ITEM pSocket );
int      hb_socketSetTimeLimit( PHB_ITEM pSocket, int iTimeOut );
PHB_ITEM hb_socketCallBack( PHB_ITEM pSocket, PHB_ITEM pBlock );
void     hb_socketClearCallBack( PHB_ITEM pSocket );
int      hb_socketSelect( PHB_ITEM aRdSock, PHB_ITEM aWrSock,
                          PHB_ITEM aExSock, int iTimeOut );
int      hb_socketRecv( PHB_ITEM pSocket, int iMode,
                        BYTE * pBuffer, int iLen );
BYTE *   hb_socketRecvUntil( PHB_ITEM pSocket, const BYTE * szStop,
                             int iMaxSize, int * piLen );
BYTE *   hb_socketRecvMUntil( PHB_ITEM pSocket, const BYTE ** szStop, int 
iCount,
                              int iMaxSize, int * piLen );
int      hb_socketDataReady( PHB_ITEM pSocket, int iTimeOut );
int      hb_socketCanWrite( PHB_ITEM pSocket, int iTimeOut ); /* new */
int      hb_socketSend( PHB_ITEM pSocket, int iMode,
                        BYTE * pBuffer, int iLen );

PHB_ITEM hb_socketGetHosts( const char * szHostName );
PHB_ITEM hb_socketGetAlias( const char * szHostName );
char *   hb_socketGetHostIP( const char * szHostName, char * szHostIP );
PHB_ITEM hb_socketServer( PHB_ITEM pSocket, int iPort, char * szAddrIP, int 
iListenQueue );
PHB_ITEM hb_socketAccept( PHB_ITEM pSocket );
PHB_ITEM hb_socketConnect( PHB_ITEM pSocket, const char * szHost, int iPort );
PHB_ITEM hb_socketConnectIP( PHB_ITEM pSocket, const char * szHostIP, int iPort 
);
BOOL     hb_socketExists( PHB_ITEM pSocket );
PHB_ITEM hb_socketDGramNew( BOOL fBoradCast );
PHB_ITEM hb_socketDGramBindNew( int iPort, const char * szAddrIP, BOOL 
fBoradCast,
                                const char * szMulticastAddr );
int      hb_socketDGramSend( PHB_ITEM pSocket, const char * szHostIP, int iPort,
                             BYTE * pBuffer, int iLen );
int      hb_socketDGramRecv( PHB_ITEM pSocket, BYTE * pBuffer, int iLen );

const char * hb_socketEOL( void );
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to