Re: [go-nuts] Order of calls to conn.Read and conn.Write on server and client

2024-08-12 Thread 'lijh8' via golang-nuts
updated.  the order of calls to read and write does not matter, read and write will not block each other. the same handleConnection function can be used on both server and client sides. the only difference is the message content which is read and written. ``` func handleConnection(conn net.C

Re: [go-nuts] Order of calls to conn.Read and conn.Write on server and client

2024-08-12 Thread 'lijh8' via golang-nuts
Hi, I updated code like this. now I can use the same handleConnection both server and client, the only difference is the content of message which is read or written. ``` func handleConnection(conn net.Conn) { defer conn.Close() msgID := 0 reader := bufio.NewReader(

Re: [go-nuts] Order of calls to conn.Read and conn.Write on server and client

2024-08-11 Thread Robert Engels
Also the proper use of Go routines allow you to implement async without the messiness of callbacks. On Aug 11, 2024, at 1:49 PM, Robert Engels wrote:This is not true. The synchronous requirements are based on higher level protocol requirements. You can just as easily do async with Reader and Writ

Re: [go-nuts] Order of calls to conn.Read and conn.Write on server and client

2024-08-11 Thread Robert Engels
This is not true. The synchronous requirements are based on higher level protocol requirements. You can just as easily do async with Reader and Writer. Eg. The client can send multiple requests and the server could respond to these out of order (I.e the response contains the request id) or not resp