Close

From Spectrum
Revision as of 11:52, 16 August 2008 by Winston (talk | contribs) (New page: '''close, sockclose (HLCALL 0x3E03)''' - close a socket == Synopsis == ''Assembly language'' ld a, (v_sockfd) ld hl, CLOSE call HLCALL ''C'' #include <sys/socket.h...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

close, sockclose (HLCALL 0x3E03) - close a socket

Synopsis

Assembly language

    ld a, (v_sockfd)
    ld hl, CLOSE
    call HLCALL

C

    #include <sys/socket.h>

    int sockclose(int sockfd);

Description

The close/sockclose function closes a socket. In the C library, the function call is defined as sockclose, since the Z88DK fcntl is not yet generalized enough to use the base close() routine to close sockets. The socket to close is passed in the parameter sockfd.

For the assembler routine, the socket to close is passed in the A register.

Return values

The C routine returns -1 if an error occurs.

The assembly language routine sets the carry flag, and returns the error code in A if the call fails.