Click here to Skip to main content
15,888,802 members
Home / Discussions / C#
   

C#

 
GeneralRe: Shamless repost - related to delegates Pin
dan!sh 17-Jun-11 10:43
professional dan!sh 17-Jun-11 10:43 
JokeRe: Shamless repost - related to delegates Pin
Richard MacCutchan17-Jun-11 22:55
mveRichard MacCutchan17-Jun-11 22:55 
GeneralRe: Shamless repost - related to delegates Pin
dan!sh 17-Jun-11 10:57
professional dan!sh 17-Jun-11 10:57 
GeneralRe: Shamless repost - related to delegates Pin
Pete O'Hanlon17-Jun-11 11:00
mvePete O'Hanlon17-Jun-11 11:00 
GeneralRe: Shamless repost - related to delegates Pin
Bibekananda Mallick19-Jun-11 19:08
Bibekananda Mallick19-Jun-11 19:08 
GeneralRe: Shamless repost - related to delegates Pin
Pete O'Hanlon19-Jun-11 23:41
mvePete O'Hanlon19-Jun-11 23:41 
AnswerRe: Shamless repost - related to delegates Pin
PIEBALDconsult17-Jun-11 14:52
mvePIEBALDconsult17-Jun-11 14:52 
QuestionDownloading binaries sockets Pin
krosty478217-Jun-11 7:29
krosty478217-Jun-11 7:29 
Hi.
A couple of days ago i had a similar discussion here:
Days ago i had a discussion here:

http://www.codeproject.com/Messages/3923426/Re-Getting-data-from-host-convert-to-string-and-th.aspx[^]

The user called Luc patyn told me to use this code:

using (NetworkStream nStream = new NetworkStream(getSocket(numsock).getSocket(),true)) {<br />
    using (FileStream fs = new FileStream("C:\\Users\\Mauri\\Desktop\\" + item.Name, FileMode.Append, FileAccess.Write)) {<br />
        using (BinaryWriter writer = new BinaryWriter(fs)) {           <br />
            for(;;) {<br />
                int len=nStream.Read(myReadBuffer, 0, myReadBuffer.Length);<br />
                if (len==0) break;<br />
                writer.Write(myReadBuffer, 0, len);<br />
            }<br />
        }<br />
    }<br />
}<br />


But my problem is that the socket never returns "0" so it gives a timeout exception:

Unable to write data to the transport connection: An error occurred during connection attempt because the connected part did not properly respond after a period of time, or failed to established connection and connected host has failed to respond.<br />


in this line:
int len = nStream.Read(myReadBuffer, 0, myReadBuffer.Length);

Thanks
AnswerRe: Downloading binaries sockets Pin
Mark Salsbery17-Jun-11 10:22
Mark Salsbery17-Jun-11 10:22 
AnswerRe: Downloading binaries sockets Pin
BobJanova20-Jun-11 0:00
BobJanova20-Jun-11 0:00 
QuestionAsynchronous database callback Pin
Herman<T>.Instance17-Jun-11 5:30
Herman<T>.Instance17-Jun-11 5:30 
AnswerRe: Asynchronous database callback Pin
BobJanova17-Jun-11 5:39
BobJanova17-Jun-11 5:39 
GeneralRe: Asynchronous database callback Pin
Herman<T>.Instance17-Jun-11 7:38
Herman<T>.Instance17-Jun-11 7:38 
GeneralRe: Asynchronous database callback Pin
BobJanova17-Jun-11 7:41
BobJanova17-Jun-11 7:41 
GeneralRe: Asynchronous database callback Pin
Herman<T>.Instance17-Jun-11 8:03
Herman<T>.Instance17-Jun-11 8:03 
GeneralRe: Asynchronous database callback Pin
BobJanova17-Jun-11 8:09
BobJanova17-Jun-11 8:09 
GeneralRe: Asynchronous database callback Pin
Herman<T>.Instance17-Jun-11 8:36
Herman<T>.Instance17-Jun-11 8:36 
QuestionTime Sheet software Pin
dipuks17-Jun-11 3:09
dipuks17-Jun-11 3:09 
AnswerRe: Time Sheet software Pin
Pete O'Hanlon17-Jun-11 3:23
mvePete O'Hanlon17-Jun-11 3:23 
GeneralRe: Time Sheet software Pin
dipuks17-Jun-11 5:02
dipuks17-Jun-11 5:02 
AnswerRe: Time Sheet software Pin
Not Active17-Jun-11 3:27
mentorNot Active17-Jun-11 3:27 
GeneralRe: Time Sheet software Pin
Roger Wright17-Jun-11 10:50
professionalRoger Wright17-Jun-11 10:50 
QuestionDateTime to yyyy\MM\dd conversion Pin
Chesnokov Yuriy16-Jun-11 23:03
professionalChesnokov Yuriy16-Jun-11 23:03 
AnswerRe: DateTime to yyyy\MM\dd conversion Pin
Richard MacCutchan16-Jun-11 23:05
mveRichard MacCutchan16-Jun-11 23:05 
AnswerRe: DateTime to yyyy\MM\dd conversion PinPopular
Eraser_stp16-Jun-11 23:14
Eraser_stp16-Jun-11 23:14 

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.