01.06.2013 Views

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

This API function makes it possible to read options associated with a socket.<br />

Prior to calling this function, the caller must fill in a GetSocketOption type data structure.<br />

The user must set the protocol_level and optionName members. Also the pointer optionValue must<br />

point to a valid buffer in the user application's memory.<br />

The optionLength member is both an input and an output parameter. The length of the buffer must be<br />

specified at the location referenced by optionLength and this length must be sufficient for the size of the<br />

requested option data. On success, this API writes to the optionLength location the number of bytes output<br />

to the optionValue buffer.<br />

The socket options of an incoming connection (using accept) will be the same as the socket options from its<br />

listening socket.<br />

Related Topics<br />

Top of list<br />

Index page<br />

GetSocketOption typedef with option names<br />

API_SETSOCKOPT - Set socket options<br />

Interrupt 0xAC service 0x18: API_SETBLOCKINGMODE, Set socket mode<br />

Parameters<br />

AH<br />

AL<br />

BX<br />

Sets a socket in blocking or non-blocking mode<br />

0x18 (= API_SETBLOCKINGMODE)<br />

0: switch blocking off, 1: switch blocking on<br />

Socket descriptor<br />

Return Value<br />

Comments<br />

Top of list<br />

Index page<br />

DX = 0 success<br />

DX != 0 failure, AX: contains error code<br />

By default all sockets are in blocking mode. If a socket is set to non-blocking mode, socket calls like<br />

CONNECT, ACCEPT, ... do not wait until full completion. They will instead return immediately.<br />

Example usage of non-blocking mode:<br />

The connectcall returns for a non-blocking socket with -1 in DX and error code 236 if the connection<br />

was not completed. The user can call connect within a loop, periodically polling for connection<br />

completion condition while performing some other activity.<br />

Page 120 / 400

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!