Click here to Skip to main content
14,876,133 members
Home / Discussions / C#
   

C#

 
GeneralRe: Problem with Byte Pin
leppie7-Aug-08 3:43
Memberleppie7-Aug-08 3:43 
GeneralRe: Problem with Byte Pin
#realJSOP7-Aug-08 4:19
mva#realJSOP7-Aug-08 4:19 
GeneralRe: Problem with Byte Pin
softwarejaeger7-Aug-08 3:58
Membersoftwarejaeger7-Aug-08 3:58 
AnswerRe: Problem with Byte Pin
#realJSOP7-Aug-08 4:16
mva#realJSOP7-Aug-08 4:16 
GeneralRe: Problem with Byte Pin
leppie7-Aug-08 5:15
Memberleppie7-Aug-08 5:15 
GeneralRe: Problem with Byte [modified] Pin
#realJSOP7-Aug-08 5:50
mva#realJSOP7-Aug-08 5:50 
GeneralRe: Problem with Byte [modified] Pin
Daniel Grunwald7-Aug-08 6:24
MemberDaniel Grunwald7-Aug-08 6:24 
AnswerRe: Problem with Byte Pin
Daniel Grunwald7-Aug-08 6:32
MemberDaniel Grunwald7-Aug-08 6:32 
ReceiveBufferSize is the size of the socket's internal receive buffer. It has nothing to do with your "Buffer" or the received data size.

byte[] Buffer = new byte[4096]; // any size will work!
int i = clientConnection.GetStream().Read(Buffer, 0, Buffer.Length);
// the return value "i" is the amount of bytes actually received
String result = System.Text.Encoding.ASCII.GetString(Buffer,0,i);
Console.WriteLine("INCOMING PACKAGE: " + result);


Warning: a TCP stream may fragment the data, so a Read call may only read part of a "package".
Usually, you'll need to prefix the data with the size you need, or use some kind of string terminator. The easiest solution would be to terminate your "packages" using newlines. Then you just use a StreamReader.
StreamReader r = new StreamReader(clientConnection.GetStream());
String result = r.ReadLine();
Console.WriteLine("INCOMING PACKAGE: " + result);

QuestionExcel Pin
ellllllllie7-Aug-08 3:11
Memberellllllllie7-Aug-08 3:11 
AnswerRe: Excel Pin
Indivara7-Aug-08 4:56
professionalIndivara7-Aug-08 4:56 
QuestionC# Packet Question Pin
Spiro Floropoulos7-Aug-08 2:29
MemberSpiro Floropoulos7-Aug-08 2:29 
AnswerRe: C# Packet Question Pin
leppie7-Aug-08 2:51
Memberleppie7-Aug-08 2:51 
GeneralRe: C# Packet Question Pin
Spiro Floropoulos7-Aug-08 2:58
MemberSpiro Floropoulos7-Aug-08 2:58 
GeneralRe: C# Packet Question Pin
leppie7-Aug-08 3:02
Memberleppie7-Aug-08 3:02 
GeneralRe: C# Packet Question Pin
leppie7-Aug-08 3:03
Memberleppie7-Aug-08 3:03 
GeneralRe: C# Packet Question Pin
Spiro Floropoulos7-Aug-08 3:26
MemberSpiro Floropoulos7-Aug-08 3:26 
GeneralRe: C# Packet Question Pin
leppie7-Aug-08 3:29
Memberleppie7-Aug-08 3:29 
GeneralRe: C# Packet Question Pin
leppie7-Aug-08 4:19
Memberleppie7-Aug-08 4:19 
QuestionDelete Object from Memory? Pin
softwarejaeger7-Aug-08 2:26
Membersoftwarejaeger7-Aug-08 2:26 
AnswerRe: Delete Object from Memory? Pin
Simon P Stevens7-Aug-08 2:42
MemberSimon P Stevens7-Aug-08 2:42 
AnswerRe: Delete Object from Memory? Pin
#realJSOP7-Aug-08 2:44
mva#realJSOP7-Aug-08 2:44 
AnswerRe: Delete Object from Memory? Pin
Guffa7-Aug-08 2:55
MemberGuffa7-Aug-08 2:55 
Questionthe operation could not be completed. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem Pin
laziale7-Aug-08 2:23
Memberlaziale7-Aug-08 2:23 
QuestionVBScript to C# Pin
Mushtaque Nizamani7-Aug-08 1:45
MemberMushtaque Nizamani7-Aug-08 1:45 
AnswerRe: VBScript to C# Pin
AhsanS7-Aug-08 2:04
MemberAhsanS7-Aug-08 2:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.