For communication with some third-party software, I need to establish an unidirectional connection over TCP. My software only needs to send data to the other side and never will read any data. Currently I'm using the TcpClient. What would happen if there are incoming packets nonetheless and I never read them? Would they pile up somewhere and lead to some errors or the like? How would I configure the TcpClient to ignore or discard all incoming data?
The whole design is 开发者_StackOverflownot exactly what I would do, but I can't change the other software and need to bear with this.
Some nice hints on the bits inside a TcpClient would be very helpful!
I think some of the data will be buffered, waiting for you to read it. Not sure how large the buffer size is, however. I don't think it will lead to errors immediately, but if the sender is expecting to be able to write, at some point the write may time out and the other party may choose to close the connection.
Nothing will happen from your point of view. Data will be discarded.
精彩评论