Current time: 29 Apr 2024, 07:27 AM



Help with C#
Away SmG FlasH™

Senior Member
Senior Member
******
11 Years of Service
Posts: 3,129
Threads: 102
Likes Received: 0 in 0 posts
Likes Given: 0
Joined: Apr 2013
Reputation: 141
Location: Summoners Rift
Halo GodCrystal DonatorSmoothThe BombDiscord WarriorGavel of TrinityDiamondGamerProgrammerThanks From Cloud
#1
Help with C#

So I'm working on a ChatApp which uses Tcp Clients and Tcp Listeners. 

So basically, I use NetworkStream to transfer data between the server and the client. The data is transferred in Bytes (byte []) and converted to String and displayed.
I use Encoding.ASCII.GetString() to convert it from bytes to String.

The problem is that when I convert bytes to string, the string contains null spaces, so I can't append text/ get substring of it.

Would be helpful if anyone can suggest a way to remove the null spaces or having the byte array size set to size of the string (in bytes) when receving from a stream.

Thanx in advance.

TLDR: Suggest a way to remove null spaces from string which use an encoder to convert byte array into string since data is transferred through networkstreams
[Image: SPOILER_FlasH-1.gif]
(This post was last modified: 06 May 2017, 10:52 AM by FlasH™.)
06 May 2017, 10:50 AM
Find Reply


Messages In This Thread
Help with C# - by FlasH™ - 06 May 2017, 10:50 AM
RE: Help with C# - by Dragonrage - 07 May 2017, 09:00 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)
SmG Gaming, © 2010-2024
Theme By: «SmG» Cloud
Edited by: «SmG» Wires