well, telnet_fastread and telnet~_fastwrite uses this:
Code:
_tcp_nodebug int sock_fastread( tcp_Socket *s, byte *dp, int len )
{
if( s->ip_type == TCP_PROTO )
return tcp_read(s, dp, len);
else
return -1;
}
_tcp_nodebug int sock_fastwrite( tcp_Socket *s, byte *dp, int len )
{
if (s->ip_type == TCP_PROTO)
return tcp_write(s, dp, len);
else
return -1;
}
which in turn use these:
Code:
_tcp_nodebug int tcp_write( tcp_Socket *s, byte *dp, int len )
{
auto int x;
LOCK_GLOBAL(TCPGlobalLock);
LOCK_SOCK(s);
// Check that we are in state which allows writing.
if (s->state & (tcp_StateCLOSED | tcp_StateLASTACK | tcp_StateFINWT1 |
tcp_StateFINWT2 | tcp_StateCLOSING | tcp_StateTIMEWT)) {
len = -1;
goto finish;
}
if(len < 0 ) len = 0;
if( len > (x = s->maxrdatalen - s->datalen) ) len = x;
if( len > 0 ) {
root2xmem( s->buffer + s->datalen, dp, len );
s->datalen += len;
s->datatimer = _SET_TIMEOUT( sock_data_timeout*1000L );
if( s->sock_mode & TCP_LOCAL )
s->sock_mode &= ~TCP_LOCAL;
else {
if( s->sock_mode & TCP_MODE_NONAGLE ) {
tcp_send( s, 40 );
} else {
/* transmit if no unacked data or got complete MTU worth */
if (!s->unacked ||
s->datalen - s->unacked >= s->mss &&
s->window - s->unacked >= s->mss)
tcp_send( s, 41 );
else
tcp_sendsoon( s, 42 );
}
}
}
finish:
UNLOCK_SOCK(s);
UNLOCK_GLOBAL(TCPGlobalLock);
return( len );
}
any help??