diff --git a/src/comm/comm.go b/src/comm/comm.go index d790f7d..aea7486 100644 --- a/src/comm/comm.go +++ b/src/comm/comm.go @@ -33,7 +33,7 @@ func (c Comm) Close() { } func (c Comm) Write(b []byte) (int, error) { - c.connection.Write([]byte(fmt.Sprintf("%0.8d", len(b)))) + c.connection.Write([]byte(fmt.Sprintf("%0.6d", len(b)))) n, err := c.connection.Write(b) if n != len(b) { err = fmt.Errorf("wanted to write %d but wrote %d", n, len(b)) @@ -43,8 +43,8 @@ func (c Comm) Write(b []byte) (int, error) { } func (c Comm) Read() (buf []byte, numBytes int, bs []byte, err error) { - // read until we get 8 bytes - tmp := make([]byte, 8) + // read until we get 6 bytes + tmp := make([]byte, 6) n, err := c.connection.Read(tmp) if err != nil { return @@ -58,7 +58,7 @@ func (c Comm) Read() (buf []byte, numBytes int, bs []byte, err error) { for { // see if we have enough bytes bs = bytes.Trim(bs, "\x00") - if len(bs) == 8 { + if len(bs) == 6 { break } n, err := c.connection.Read(tmp) diff --git a/src/models/constants.go b/src/models/constants.go index c0bd9fa..1f228a1 100644 --- a/src/models/constants.go +++ b/src/models/constants.go @@ -1,4 +1,4 @@ package models const WEBSOCKET_BUFFER_SIZE = 1024 * 1024 * 32 -const TCP_BUFFER_SIZE = 1024 * 1024 * 32 +const TCP_BUFFER_SIZE = 993280