Click here to Skip to main content
15,895,256 members
Home / Discussions / C#
   

C#

 
Questiontimeout in second call webservice???? Pin
leonvanrooijen31-Jan-06 10:04
leonvanrooijen31-Jan-06 10:04 
Questionmy application with graphic Pin
Sasuko31-Jan-06 10:02
Sasuko31-Jan-06 10:02 
QuestionThreading Pin
nc3b31-Jan-06 9:48
nc3b31-Jan-06 9:48 
AnswerRe: Threading Pin
Le centriste31-Jan-06 10:13
Le centriste31-Jan-06 10:13 
GeneralRe: Threading Pin
nc3b31-Jan-06 10:15
nc3b31-Jan-06 10:15 
Questiondo I need a lience to use word.dll in a commercial product Pin
Agyeman31-Jan-06 9:38
Agyeman31-Jan-06 9:38 
AnswerRe: do I need a lience to use word.dll in a commercial product Pin
Praveen Nayak31-Jan-06 17:20
Praveen Nayak31-Jan-06 17:20 
QuestionBinary Data & .Net Sockets, URGENT Pin
John Gouda31-Jan-06 9:27
John Gouda31-Jan-06 9:27 
Hello every one

After 2 hard week of work, finally i accomplished an reliable server and client classes which look like the VB Winsock, those 2 classes are reliable, also server enable multiple connections, as i test it accept 5000 connection and Handel them,

When i try to create an demo app. on these 2 powerful classes, all goes fine, i faced an problem in sending files, as I'm using one channel only between server and client, i.e. each client have only one channel, this channel Handel both data and commands, we can distinguished between them, that command will always contain [#<cmd>#] tag before the command itself, so in the OnDataReceived event, we convert the byte array to ASCII string to search inside it, if we find the prev. tag then this a command else we just use that array to put on file or something, the logic is tested before on my prev. vb6 app.

Here an scenario of connection,
1- Client connected to server, server add its info to listview,
2- Server request from client to capture desktop screen
3- Client receive the command and capture the image convert it to JPEG, and then add to that array the following tag at the end of array [#<eof>#], which help us to detect the end of file.
4- Client tell the server that it ready to send, given to server the length of image array without the length of tag,
5- When server receive readytosend, it the client socket info to helper class which contain the socket id, image size, and memory stream, which contain image chunks,
6- then Server send the client an message ready to receive, in this moment client start sending data chunks in order of 1024 Byte per time,
7- Every time server receive data it check if its EOF or not, if its, remove the EOF tag, and all nulls, and write the last chunk to the image,

The problem is the image in coming deformed, also some times length of incoming data become greater than length saved from client in early steps, i.e. an **** on line collected while getting data,

After hard work, i try to put an execution delayer, using Thread.Sleep(0), and the surprise that its finally work, and the image size is correctly, and image is nice, But all this in LAN, when test app on Wan all goes bad again, i think the problem not the delay, but delay here prevent some bad thing to happen, i want to know why server put extra data on the image stream, from where these extra data come, Am I Missing Something.?!?!?!??!?!?!?

All i need, Any one test this code, its amazing, very exciting and commented, will learn you a lot, all i need is to detect the reason of that bugs,

To know what I'm talking about, In the server side in the OnDataReceived even, try to comment the Thread.Sleep(0); and try to get an image, you will got ****, if you put that line again all goes fine, and if you put it, and test it on Wan it will cause problems again, So there is something wrong, and i don't know it

Please any body help me finding that error.

Here is the link of the code, its written using C# 2005, Right click and choose Save Target As...

http://www40.brinkster.com/dominatorlegend/Network_Spy.rar[^]

Thanks every one and hope i explain the problem well, and hope for fast response.
Thanks in advanced for whatever help.

-- modified at 6:41 Wednesday 1st February, 2006
QuestionHow does 1 thread multiply into 3 threads??? Pin
WetRivrRat31-Jan-06 8:27
WetRivrRat31-Jan-06 8:27 
AnswerRe: How does 1 thread multiply into 3 threads??? Pin
Wjousts31-Jan-06 10:59
Wjousts31-Jan-06 10:59 
QuestionHow can a custom control or form tell that it’s in design mode? Pin
Chris Levin31-Jan-06 8:09
Chris Levin31-Jan-06 8:09 
AnswerRe: How can a custom control or form tell that it’s in design mode? Pin
malharone31-Jan-06 8:33
malharone31-Jan-06 8:33 
GeneralRe: How can a custom control or form tell that it’s in design mode? Pin
Chris Levin31-Jan-06 8:35
Chris Levin31-Jan-06 8:35 
AnswerRe: How can a custom control or form tell that it’s in design mode? Pin
kasik31-Jan-06 8:42
kasik31-Jan-06 8:42 
GeneralRe: How can a custom control or form tell that it’s in design mode? Pin
malharone31-Jan-06 8:51
malharone31-Jan-06 8:51 
QuestionWierd behavior with ALT key shortcuts Pin
Dan Neely31-Jan-06 8:07
Dan Neely31-Jan-06 8:07 
QuestionHow to Call Javascript function from code behind after dialog box appearance Pin
psmukil31-Jan-06 7:49
psmukil31-Jan-06 7:49 
QuestionPosting Data to a Blog Pin
AB777131-Jan-06 3:48
AB777131-Jan-06 3:48 
AnswerRe: Posting Data to a Blog Pin
User 665831-Jan-06 4:40
User 665831-Jan-06 4:40 
AnswerRe: Posting Data to a Blog Pin
tarasn31-Jan-06 4:49
tarasn31-Jan-06 4:49 
QuestionKeypress handling in Simple DataGrid Pin
hellamasta31-Jan-06 3:44
hellamasta31-Jan-06 3:44 
AnswerRe: Keypress handling in Simple DataGrid Pin
Alomgir Miah31-Jan-06 7:54
Alomgir Miah31-Jan-06 7:54 
GeneralRe: Keypress handling in Simple DataGrid Pin
hellamasta31-Jan-06 8:44
hellamasta31-Jan-06 8:44 
Questionalternate ways to force a process to close. Pin
Dan Neely31-Jan-06 3:22
Dan Neely31-Jan-06 3:22 
AnswerRe: alternate ways to force a process to close. Pin
Wjousts31-Jan-06 5:59
Wjousts31-Jan-06 5:59 

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.