47 |
let buf = TcpBufferedSocket.internal_buf |
let buf = TcpBufferedSocket.internal_buf |
48 |
|
|
49 |
let client_msg_to_string emule_version msg = |
let client_msg_to_string emule_version msg = |
50 |
Buffer.clear buf; |
Buffer.reset buf; |
51 |
buf_int8 buf 0; |
buf_int8 buf 0; |
52 |
buf_int buf 0; |
buf_int buf 0; |
53 |
let magic = DonkeyProtoClient.write emule_version buf msg in |
let magic = DonkeyProtoClient.write emule_version buf msg in |
58 |
s |
s |
59 |
|
|
60 |
let server_msg_to_string msg = |
let server_msg_to_string msg = |
61 |
Buffer.clear buf; |
Buffer.reset buf; |
62 |
buf_int8 buf 227; |
buf_int8 buf 227; |
63 |
buf_int buf 0; |
buf_int buf 0; |
64 |
DonkeyProtoServer.write buf msg; |
DonkeyProtoServer.write buf msg; |
178 |
end; |
end; |
179 |
|
|
180 |
try |
try |
181 |
Buffer.clear buf; |
Buffer.reset buf; |
182 |
DonkeyProtoUdp.write buf msg; |
DonkeyProtoUdp.write buf msg; |
183 |
let s = Buffer.contents buf in |
let s = Buffer.contents buf in |
184 |
UdpSocket.write t false s ip port |
UdpSocket.write t false s ip port |
338 |
!!client_buffer_size - 100 |
!!client_buffer_size - 100 |
339 |
- TcpBufferedSocket.remaining_to_write sock |
- TcpBufferedSocket.remaining_to_write sock |
340 |
in |
in |
341 |
Buffer.clear buf; |
Buffer.reset buf; |
342 |
let s = |
let s = |
343 |
buf_int buf 0; |
buf_int buf 0; |
344 |
let nfiles, prev_len = |
let nfiles, prev_len = |
351 |
let s = String.sub s 0 prev_len in |
let s = String.sub s 0 prev_len in |
352 |
if !verbose_share then |
if !verbose_share then |
353 |
lprintf_nl () "Sending %d share(s) to server : " nfiles; |
lprintf_nl () "Sending %d share(s) to server : " nfiles; |
354 |
Buffer.clear buf; |
Buffer.reset buf; |
355 |
let s_c = |
let s_c = |
356 |
if compressed && Autoconf.has_zlib then |
if compressed && Autoconf.has_zlib then |
357 |
Autoconf.zlib__compress_string s |
Autoconf.zlib__compress_string s |
388 |
let client_send_files sock msg = |
let client_send_files sock msg = |
389 |
let max_len = !!client_buffer_size - 100 - |
let max_len = !!client_buffer_size - 100 - |
390 |
TcpBufferedSocket.remaining_to_write sock in |
TcpBufferedSocket.remaining_to_write sock in |
391 |
Buffer.clear buf; |
Buffer.reset buf; |
392 |
buf_int8 buf 227; |
buf_int8 buf 227; |
393 |
buf_int buf 0; |
buf_int buf 0; |
394 |
buf_int8 buf 75; (* ViewFilesReply *) |
buf_int8 buf 75; (* ViewFilesReply *) |