View Single Post
Old 11-10-2012, 14:21   #9
banryu79
Senior Member
 
L'Avatar di banryu79
 
Iscritto dal: Oct 2007
Città: Padova
Messaggi: 4131
Quote:
Originariamente inviato da marco.r Guarda i messaggi
No, cdimauro ha detto che _python_ non fa buffering. Poi dipende da quello che fa la libreria C e il sistema operativo.
Volevo dire che anche per Java è così.
La libreria fornisce dei precotti per i casi d'uso più comuni.
Ad esempio ci sono java.net.SSLSocket e java.net.SSLServerSocket che poi non sono altro che specializzazioni di java.net.Socket/java.net.ServerSocket per TCP. C'è poi java.net.DatagramSocket per UDP.

le varie classi Socket/DatagramSocket delegano il "vero" lavoro alle astrazioni java.net.SocketImpl e java.net.DatagramSocketImpl: ogni piattaforma fornisce la propria specifica implementazione di queste due classi astratte.
Queste implementazioni platform-specific concretizzano (implementano) l'interfaccia comune e trasversale: java.net.SocketOptions.

E in SocketOprions troviamo opzioni per i socket molto specifiche tra cui alcune significative, tipo: SO_RCVBUF, SO_SNDBUF e TCP_NODELAY.
Queste non sono relative a Java, ma alla piattaforma/sistema su cui gira la vm, ad esempio il javadoc di SO_RCVBUF recita:
Quote:
static final int SO_RCVBUF

Set a hint the size of the underlying buffers used by the platform for incoming network I/O. When used in set, this is a suggestion to the kernel from the application about the size of buffers to use for the data to be received over the socket. When used in get, this must return the size of the buffer actually used by the platform when receiving in data on this socket. Valid for all sockets: SocketImpl, DatagramSocketImpl
Qua ho trovato delle vecchie FAQ (ma sospetto dal contenuto ancora valido) a uso e consumo di demos88
__________________

As long as you are basically literate in programming, you should be able to express any logical relationship you understand.
If you don’t understand a logical relationship, you can use the attempt to program it as a means to learn about it.
(Chris Crawford)

Ultima modifica di banryu79 : 11-10-2012 alle 14:25.
banryu79 è offline   Rispondi citando il messaggio o parte di esso