![]() |
|
| << Previous | Index | Next >> | |
| | |
int sock_fastwrite( tcp_Socket *s, byte *dp, int len );
Description
Writes up to
lenbytes fromdpto sockets. This function writes as many bytes as possible to the socket and returns that number of bytes. Starting with Dynamic C 7.05, this function is only valid for TCP sockets. For UDP sockets, useudp_send()orudp_sendto().When using a UDP socket prior to DC 7.05,
sock_fastwrite()will send one record iflen <= ETH_MTU - 20 - 8
ETH_MTUis the Ethernet Maximum Transmission Unit; 20 is the IP header size and 8 is the UDP header size. By default, this is 572 bytes. Iflenis greater than this number, then the function does not send the data and returns -1. Otherwise, the UDP datagram would need to be fragmented.For TCP, the new data is queued for sending and
sock_fastwrite()returns the number of bytes that will be sent. The data may be transmitted immediately if enough data is in the buffer, or sufficient time has expired, or the user has explicitly usedsock_flushnext()to indicate this data should be flushed immediately. In either case, no guarantee of acceptance at the other end is possible.Parameters
s
- Pointer to a socket.
dp
- Buffer to be written.
len
- Maximum number of bytes to write to the socket.
Return value
- ≥
0: Success, number of bytes written.-1: Error.Library
TCP.LIB (Prior to DC 7.05, this was DCRTCP.LIB)
See Also
| TCP/IP Manual Vol 1 |
<<Previous | Index | Next>> | rabbit.com |