case 4: // Append IPv4 Pseudo Header
buflen = 4 + 4 + 4 + ((Length+1)&~1);
buf = malloc( buflen );
- buf[0] = Conn->Interface->IP4.Address.L;
+ buf[0] = ((tIPv4*)Conn->Interface->Address)->L;
buf[1] = Conn->RemoteIP.v4.L;
buf[2] = (htons(Length)<<16) | (6<<8) | 0;
Data->Checksum = 0;
if(conn->State != TCP_ST_CLOSED) return -1;
if(!CheckMem(Data, sizeof(Uint16))) return -1;
conn->RemotePort = *(Uint16*)Data;
- return 0;
+ return conn->RemotePort;
case 6: // Set Remote IP
if( conn->State != TCP_ST_CLOSED )
TCP_StartConnection(conn);
return 1;
+
+ // Get recieve buffer length
+ case 8:
+ return conn->RecievedBuffer->Length;
}
return 0;