Re: [go-nuts] Guarantee tcp pkt delivery

2021-05-19 Thread Perry Couprie
Op wo 19 mei 2021 13:37 schreef Amarjeet Anand : > Hi > > Consider a sequence of events--- > > 1. Tcp server started on port 8080 using *net.Listen("tcp", ":8080")* > > 2. Tcp client established a connection using *net.Dial("tcp", ":8080") *and > received a *conn* object. > > 3. Tcp server is forc

Re: [go-nuts] Help with tcpserver

2021-04-01 Thread Perry Couprie
It works now i added the ReadDeadline, thanks for the help :-) Perry On Wednesday, March 31, 2021 at 1:22:20 PM UTC+2 Brian Candler wrote: > I think that in principle you are correct to perform your reads inside a > goroutine, to allow them to be received asynchronously. > > If Read() blocks, i

Re: [go-nuts] Help with tcpserver

2021-03-31 Thread Perry Couprie
The protocol i am programming for sends a header of 8 bytes that contains a body length. My problem is dat c.Read(buf) is blocking. Can i read from the tcp connection non blocking ? On Wednesday, March 31, 2021 at 9:08:48 AM UTC+2 Brian Candler wrote: > On Wednesday, 31 March 2021 at 04:13:12

Re: [go-nuts] Help with tcpserver

2021-03-31 Thread Perry Couprie
all guaranteed to match the number of bytes the client sent. > The returned data can be part of one or more messages. You need some other > mechanism to divide the data received into messages. For example you might > want to read a line at a time instead. > > On Tue, Mar 30, 2021 a

[go-nuts] Help with tcpserver

2021-03-30 Thread Perry Couprie
Hi, I create a tcp server with goroutines. When the tcp client closes the connection it workes. After recieving 5 message from a telnet client it tries to close the connection. Some times it works, and sometimes not. I create a smal demo : https://pastebin.com/raw/BjZWzLFq This is my first tr

[go-nuts] Cannot use messageBody (type []byte) as type byte in append ?

2021-03-27 Thread Perry Couprie
I created the following test code. To isolate the compile error. Why do i get the error message : cannot use messageBody (type []byte) as type byte in append. Greeting from Amsterdam, Perry package main import ( "encoding/hex" "fmt" ) func encodeMessage(messageBody []byte) ([]byte) { tmp,_