c# - Socket.Disconnect(bool reuse) -
socket.disconnect(bool reuse)
according msdn enables program reuse socket. questions are:
if decide reuse socket mean reuse same local end point well? preserve port socket or (i don't believe does) save objects resources?
if in effect save resources allocated next connection , if send/receive buffers automaticly flush or there way flush them?
socket.shutdown(shutdown.both)
me on disconnect?in situation use
socket.disconnect(false)
? if purpose reuse socket grant me?
if reuse = false socket disposed automatically after closing. settings endpoint , buffer sizes not reseted defaults, can change if desire. supose user decides change connection port. need close socket, change port , connect socket again without create new socket , set again.
the socket.shutdown disables send/receive/both; not disconnect socket. occurs new incoming/outgoing data buffers flushed normaly. practice call before disconnection ensure data sent , no data being received while disconnecting.
returning example of 1. supose need change port. dont want create socket again, configure parameters of socket events , buffers again, etc. consumes time , resources, better reuse socket have.
Comments
Post a Comment