Skip to content

Commit

Permalink
Flush stream on send
Browse files Browse the repository at this point in the history
  • Loading branch information
SkySwimmer committed Oct 12, 2023
1 parent ab98802 commit eafa2e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions PX Framework/Common/Phoenix.Common.IO/DataWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ public DataWriter(Stream output)
Output = output;
}

/// <summary>
/// Retrieves the target output byte stream
/// </summary>
/// <returns>Stream instance</returns>
public Stream GetStream() {
return Output;
}

/// <summary>
/// Writes a single byte
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,7 @@ protected override void SendPacket(int cId, int id, AbstractNetworkPacket packet
Writer.WriteInt(cId);
Writer.WriteInt(id);
Writer.WriteBytes(packetData);
Writer.GetStream().Flush();
}
catch
{
Expand Down Expand Up @@ -974,6 +975,7 @@ protected override void SendPacket(int cId, int id, AbstractNetworkPacket packet
Writer.WriteInt(cId);
Writer.WriteInt(id);
packet.Write(Writer);
Writer.GetStream().Flush();
}
catch
{
Expand Down

0 comments on commit eafa2e4

Please sign in to comment.