Click here to Skip to main content
15,886,110 members
Home / Discussions / C#
   

C#

 
AnswerRe: notification text click event Pin
Gerry Schmitz10-May-17 6:57
mveGerry Schmitz10-May-17 6:57 
AnswerRe: notification text click event Pin
OriginalGriff10-May-17 8:03
mveOriginalGriff10-May-17 8:03 
QuestionRe: notification text click event Pin
CHill6010-May-17 23:26
mveCHill6010-May-17 23:26 
AnswerRe: notification text click event Pin
John C Rayan11-May-17 5:52
professionalJohn C Rayan11-May-17 5:52 
QuestionC# windows application system and cloud Pin
Zeyad Jalil9-May-17 23:41
professionalZeyad Jalil9-May-17 23:41 
AnswerRe: C# windows application system and cloud Pin
Dave Kreskowiak10-May-17 2:35
mveDave Kreskowiak10-May-17 2:35 
AnswerRe: C# windows application system and cloud Pin
Afzaal Ahmad Zeeshan10-May-17 5:31
professionalAfzaal Ahmad Zeeshan10-May-17 5:31 
QuestionC# Network and streams Pin
TheTrigger9-May-17 11:12
TheTrigger9-May-17 11:12 
Hello guys, i really need help for this
i'm writing in C# a client-server (not important maybe, but it's for a game), probably i need more knowledge and clarification about the process.

Firts of all, the process is the same for client and server, and EVERYTHING IS (+or-)WORKING.

My code should explain what i'm doing
C#
/// STREAM READER
new Thread(() =>
{
	int i = 0;
	while (true)
	{
		byte[] bytes = new byte[102400]; // 100k max buffer
		NetworkStream stream = client.GetStream();

		int received = stream.Read(bytes, 0, bytes.Length);
		Console.WriteLine("Packets: " + ++i);

		// Binary deserialization
		var basepacket = TNetwork.Encaps.Deserialize(bytes, 0, received);
		Thread.Sleep(1000);

	}
}).Start();


But there are some points that i don't get.

1) If i Send packets quickly
C#
while(spamtest)
	bp.Send(stream, ...);

the other point doesn't process all incoming data if it is busy (send 1000, processed 200). How to solve? i won't lose informations. there are no a kinda of SampleAndHold system? How is possible that i'm losing tcp packets just cause the program was busy??

2) I tried to send some data of 2k over the network (with another pc) but i had no problems. MTU is 1500 so my endpoint should crash getting incomplete binary-serialized-classes ! No?

I'm going crazy. My implementation is ok or i'm missing something?

3) Maybe client.GetStream(); can i only write or read at once? If i write, can't read? neither with 2 threads?

4) Probably i have to separate the Send process to a Queue in another thread.

5) What does exactly the flush()? I need to use it? I tried with and without Flush() after stream.write no differences (autoflush is false).

6) if i let client spam 70.000 packets, at the end one of both crashes

Help me please, getting crazy. Thanks

modified 10-May-17 8:17am.

AnswerRe: C# Network and streams Pin
Bernhard Hiller9-May-17 21:30
Bernhard Hiller9-May-17 21:30 
GeneralRe: C# Network and streams Pin
TheTrigger10-May-17 2:26
TheTrigger10-May-17 2:26 
GeneralRe: C# Network and streams Pin
Dave Kreskowiak10-May-17 2:38
mveDave Kreskowiak10-May-17 2:38 
GeneralRe: C# Network and streams Pin
TheTrigger10-May-17 2:52
TheTrigger10-May-17 2:52 
GeneralRe: C# Network and streams Pin
Dave Kreskowiak10-May-17 4:31
mveDave Kreskowiak10-May-17 4:31 
GeneralRe: C# Network and streams Pin
TheTrigger10-May-17 5:48
TheTrigger10-May-17 5:48 
GeneralRe: C# Network and streams Pin
Dave Kreskowiak10-May-17 6:41
mveDave Kreskowiak10-May-17 6:41 
GeneralRe: C# Network and streams Pin
TheTrigger10-May-17 9:12
TheTrigger10-May-17 9:12 
GeneralRe: C# Network and streams Pin
Dave Kreskowiak10-May-17 11:52
mveDave Kreskowiak10-May-17 11:52 
GeneralRe: C# Network and streams Pin
TheTrigger10-May-17 22:48
TheTrigger10-May-17 22:48 
AnswerRe: C# Network and streams Pin
Gerry Schmitz10-May-17 5:00
mveGerry Schmitz10-May-17 5:00 
GeneralRe: C# Network and streams Pin
TheTrigger10-May-17 5:56
TheTrigger10-May-17 5:56 
GeneralRe: C# Network and streams Pin
Dave Kreskowiak10-May-17 6:25
mveDave Kreskowiak10-May-17 6:25 
GeneralRe: C# Network and streams Pin
TheTrigger10-May-17 8:50
TheTrigger10-May-17 8:50 
QuestionLabel link on top of the page Pin
Member 131892689-May-17 3:51
Member 131892689-May-17 3:51 
AnswerRe: Label link on top of the page Pin
Richard MacCutchan9-May-17 4:51
mveRichard MacCutchan9-May-17 4:51 
AnswerRe: Label link on top of the page Pin
OriginalGriff9-May-17 5:36
mveOriginalGriff9-May-17 5:36 

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.