Close

From Spectrum
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.