Dipi
Dipi
CC#
Created by Dipi on 6/4/2023 in #help
✅ Async receive receiving extra bytes
its seems to be fixed god know how....
8 replies
CC#
Created by Dipi on 6/4/2023 in #help
✅ Async receive receiving extra bytes
public async Task ReadIncomingPackets(Socket client) {
try {
while (client.Connected) {
byte[] buffer = new byte[4096];
var segment = new ArraySegment<byte>(buffer);
var read = await client.ReceiveAsync(segment,SocketFlags.None);
Debug.Log(read);
}
}
catch (System.Exception e) {
Debug.Log(e);
throw;
}

}
public async Task ReadIncomingPackets(Socket client) {
try {
while (client.Connected) {
byte[] buffer = new byte[4096];
var segment = new ArraySegment<byte>(buffer);
var read = await client.ReceiveAsync(segment,SocketFlags.None);
Debug.Log(read);
}
}
catch (System.Exception e) {
Debug.Log(e);
throw;
}

}
8 replies
CC#
Created by Dipi on 6/4/2023 in #help
✅ Async receive receiving extra bytes
It’s super simple code Creating a buffer passing it to the Socket.RecevieAsync and sending a message form the server and when the the receive async return value is +10 form the actual size sent. for example I am sending 2 bytes the client receive 12
8 replies