473,839 Members | 1,330 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File Transfer Problem in c#

I have a problem transfering files using sockets from pocket pc(.net compact
c#) to desktop(not using .net just mfc and sockets 2 API). The socket
communication is not a issue and I am able to transfer data across.On the
serve I am using Socket 2 API (recv function to read bytes)and not using
..NET. I use FileStream to open the file on the pocket pc, then associate a
BinaryReader object with the stream and call ReadBytes to read all the bytes
into a byte array. I have a connected socket and I send this byte array
asynchronously over the network. I get the file on my computer but image
data is corrupted. I tried debugging, and found that the values that I have
in the byte array are not the same as they are in the file. Rather the
header information of the JPG gets transferred correctly. Since the file was
originally on the PC and was downloaded to the emulator by adding it to the
project. I assume that the byte values at their corresponding locations
should match with what the byte array contains after loading the file data
on the pocket pc. It does not! For instance the byte #213 is having decimal
value 62 on the PC when I see the corresponding index in the byte array it
reads 65. Is this a problem of encoding? Unicode and ASCII? Does it have
anything to do with byte ordering? why is this happening? what is the way
out to provide a simple byte to byte transfer of files from hand-held to PC
and from PC to hand-held over the network? Please reply because at this
point I have tried all options and I don't have a way out. I am able to
send textmessages to and fro client and server.

Following is the code snippet of client and server.

Server

FILE *pFile = NULL;//file pointer
BYTE recvbuf[1024];
pFile = fopen(strFileNa me,"w");//opens a file for writing if the file does
exist it will empty it
int bytesRecv = SOCKET_ERROR;//initializes to an error value.
//this a while loop that keep reading bytes till the terminating symbol is
not found in the stream
while( bytesRecv == SOCKET_ERROR || !boTermFound)
{//keep reading and writing bytes till you read the end of the message
bytesRecv = recv(AcceptSock et, (char*)recvbuf, 1024, 0 );
//have to check weather the last n bytes contain the terminator string
if (bytesRecv == 0 || bytesRecv == WSAECONNRESET )
{
AfxMessageBox( "Connection Closed");
return false;
break;
}
boTermFound = CheckForTermina tor(strTermStri ng,recvbuf,byte sRecv);
fwrite(recvbuf, sizeof(BYTE),by tesRecv, pFile);
}
fclose(pFile)

Client (.net compact c#)
-------------------------

FileStream myFileStream;
myFileStream = new
FileStream(m_st rFileName,FileM ode.Open,FileAc cess.Read,FileS hare.Read);//an
instance of FileStream
byte[] b = new byte[myFileStream.Le ngth];//create a byte array to store
for(long i=0;i<myFileStr eam.Length;i++)
b[i] = (byte)myFileStr eam.ReadByte();
myFileStream.Cl ose();
_socket.BeginSe nd(b, 0, b.Length,
SocketFlags.Non e, null, null);
// send the terminator
_asyncEvent.Res et();
_socket.BeginSe nd(Network.Term inatorBytes, 0,
Network.Termina torBytes.Length , SocketFlags.Non e, _sendCallback, true);
//this is just code that indicates termination of data.

This is becoming a serious problem. My whole project depends on
succcessfully able to transfer jpg images. Please look into this.

Regards, Abhishek
Nov 15 '05 #1
11 6643
Abhishek <ga*****@rpi.ed u> wrote:
I have a problem transfering files using sockets from pocket pc(.net compact
c#) to desktop(not using .net just mfc and sockets 2 API). The socket
communication is not a issue and I am able to transfer data across.On the
serve I am using Socket 2 API (recv function to read bytes)and not using
.NET. I use FileStream to open the file on the pocket pc, then associate a
BinaryReader object with the stream and call ReadBytes to read all the bytes
into a byte array.
That's not what the code you posted does. The code you posted reads
each byte in turn, which is pretty horrendous in terms of performance.
I'd actually use neither technique - I'd create a memory stream, and
read chunks from the file stream until you can't read any more, writing
the chunks to the memory stream as you go and then calling ToArray on
the memory stream afterwards. That way you won't get into problems if
the file size changes while you're reading, too.
I have a connected socket and I send this byte array
asynchronously over the network.


Right - the first thing to do is find out what side the error's on. I
suggest you write simple code on each side which doesn't deal with
files at all, it just either writes a fixed block of binary out to the
socket, or writes the bytes to the screen for comparison (on the reader
side).

One problem I can see on the client side is that you've effectively got
more than one thread sending data - you're sending the terminator
asynchonrously with respect to the jpeg itself, which can't be a good
idea. I don't think the terminator is a good idea in the first place,
to be honest - what's to stop it appearing in the main file? Send a
length before the data instead.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2
hi,

I had a same kind of problem with my smtp gateway...

I solved th problem by checking termination char and extract the exact data
then send to the filestram to write.

In my case
Reply from smtp server...read [1024] bytes say if the actual data is only 24
bytes .Net will fill with "\0\0\0..." the rest.

Not sure..about your problem.

Jeyapandian.

"Abhishek" <ga*****@rpi.ed u> wrote in message
news:uJ******** ******@TK2MSFTN GP12.phx.gbl...
I have a problem transfering files using sockets from pocket pc(.net compact
c#) to desktop(not using .net just mfc and sockets 2 API). The socket
communication is not a issue and I am able to transfer data across.On the
serve I am using Socket 2 API (recv function to read bytes)and not using
..NET. I use FileStream to open the file on the pocket pc, then associate a
BinaryReader object with the stream and call ReadBytes to read all the bytes
into a byte array. I have a connected socket and I send this byte array
asynchronously over the network. I get the file on my computer but image
data is corrupted. I tried debugging, and found that the values that I have
in the byte array are not the same as they are in the file. Rather the
header information of the JPG gets transferred correctly. Since the file was
originally on the PC and was downloaded to the emulator by adding it to the
project. I assume that the byte values at their corresponding locations
should match with what the byte array contains after loading the file data
on the pocket pc. It does not! For instance the byte #213 is having decimal
value 62 on the PC when I see the corresponding index in the byte array it
reads 65. Is this a problem of encoding? Unicode and ASCII? Does it have
anything to do with byte ordering? why is this happening? what is the way
out to provide a simple byte to byte transfer of files from hand-held to PC
and from PC to hand-held over the network? Please reply because at this
point I have tried all options and I don't have a way out. I am able to
send textmessages to and fro client and server.

Following is the code snippet of client and server.

Server

FILE *pFile = NULL;//file pointer
BYTE recvbuf[1024];
pFile = fopen(strFileNa me,"w");//opens a file for writing if the file does
exist it will empty it
int bytesRecv = SOCKET_ERROR;//initializes to an error value.
//this a while loop that keep reading bytes till the terminating symbol is
not found in the stream
while( bytesRecv == SOCKET_ERROR || !boTermFound)
{//keep reading and writing bytes till you read the end of the message
bytesRecv = recv(AcceptSock et, (char*)recvbuf, 1024, 0 );
//have to check weather the last n bytes contain the terminator string
if (bytesRecv == 0 || bytesRecv == WSAECONNRESET )
{
AfxMessageBox( "Connection Closed");
return false;
break;
}
boTermFound = CheckForTermina tor(strTermStri ng,recvbuf,byte sRecv);
fwrite(recvbuf, sizeof(BYTE),by tesRecv, pFile);
}
fclose(pFile)

Client (.net compact c#)
-------------------------

FileStream myFileStream;
myFileStream = new
FileStream(m_st rFileName,FileM ode.Open,FileAc cess.Read,FileS hare.Read);//an
instance of FileStream
byte[] b = new byte[myFileStream.Le ngth];//create a byte array to store
for(long i=0;i<myFileStr eam.Length;i++)
b[i] = (byte)myFileStr eam.ReadByte();
myFileStream.Cl ose();
_socket.BeginSe nd(b, 0, b.Length,
SocketFlags.Non e, null, null);
// send the terminator
_asyncEvent.Res et();
_socket.BeginSe nd(Network.Term inatorBytes, 0,
Network.Termina torBytes.Length , SocketFlags.Non e, _sendCallback, true);
//this is just code that indicates termination of data.

This is becoming a serious problem. My whole project depends on
succcessfully able to transfer jpg images. Please look into this.

Regards, Abhishek

Nov 15 '05 #3
The code I put down there is slightly different there because I have been
trying all different kind of things and this was the latest changes I was
underway. I have also used the BinaryReader method and did not work. I know
reading byte to byte is horrendous but right now I want to transfer my data
without any corruption and that is my major concern.

Its is likely that using a terminator string might not be a good idea but a
terminator string wont repeate twice. In my case I do get the terminator
string at the end of the byte transfer only. So the terminator string is not
getting mixed somewhere in the middle of the data.

About the problem being there on the client end or server end it seems most
likely it is the client end. Because I have a one JPG file which I transfer
from the desktop to the pocket pc. This is the very file I am trying to send
back using sockets. Now the way I am checking this is I am loading the files
in byte array at both ends. The first 213 bytes in the pocket pc and the
desktop are identical but things change after the 214 byte, its deciamal
value on the desktop version of the file is 62 and its value in the pocket
pc version is 65. The character corresponding to 62 is '>' and that is what
it shows when i open the file in binary on the desktop. Now from this byte
onwards things are no longer identical. Things get different if not
drastically. So what my feeling is that the pocket pc interprets byte data
in a different manner using a different encoding. But I dont know. I tried
loading the same file on the pocket pc using one file stream and writing
using another filestream and it made a copy of the image file on the pocket
pc so loading of the byte data seems ok from the pokcet pc environment but
is not having the same correspondance with the byte data on the desktop. I
hope I have answered all your questions. Please give me hints what to do
next?

Abhishek

"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Abhishek <ga*****@rpi.ed u> wrote:
I have a problem transfering files using sockets from pocket pc(.net compact c#) to desktop(not using .net just mfc and sockets 2 API). The socket
communication is not a issue and I am able to transfer data across.On the serve I am using Socket 2 API (recv function to read bytes)and not using
.NET. I use FileStream to open the file on the pocket pc, then associate a BinaryReader object with the stream and call ReadBytes to read all the bytes into a byte array.


That's not what the code you posted does. The code you posted reads
each byte in turn, which is pretty horrendous in terms of performance.
I'd actually use neither technique - I'd create a memory stream, and
read chunks from the file stream until you can't read any more, writing
the chunks to the memory stream as you go and then calling ToArray on
the memory stream afterwards. That way you won't get into problems if
the file size changes while you're reading, too.
I have a connected socket and I send this byte array
asynchronously over the network.


Right - the first thing to do is find out what side the error's on. I
suggest you write simple code on each side which doesn't deal with
files at all, it just either writes a fixed block of binary out to the
socket, or writes the bytes to the screen for comparison (on the reader
side).

One problem I can see on the client side is that you've effectively got
more than one thread sending data - you're sending the terminator
asynchonrously with respect to the jpeg itself, which can't be a good
idea. I don't think the terminator is a good idea in the first place,
to be honest - what's to stop it appearing in the main file? Send a
length before the data instead.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 15 '05 #4
So you mean i check for the first occurance of \0 or a repeated sequence of
\0\0\0 ?
You are talking of this in referene to byte transfer or simply ASCII
transfer bec I am able to do text transfer without any problems.

"Jeya" <je**@cmtsp.com .sg> wrote in message
news:Oa******** ******@TK2MSFTN GP12.phx.gbl...
hi,

I had a same kind of problem with my smtp gateway...

I solved th problem by checking termination char and extract the exact data then send to the filestram to write.

In my case
Reply from smtp server...read [1024] bytes say if the actual data is only 24 bytes .Net will fill with "\0\0\0..." the rest.

Not sure..about your problem.

Jeyapandian.

"Abhishek" <ga*****@rpi.ed u> wrote in message
news:uJ******** ******@TK2MSFTN GP12.phx.gbl...
I have a problem transfering files using sockets from pocket pc(.net compact c#) to desktop(not using .net just mfc and sockets 2 API). The socket
communication is not a issue and I am able to transfer data across.On the
serve I am using Socket 2 API (recv function to read bytes)and not using
.NET. I use FileStream to open the file on the pocket pc, then associate a BinaryReader object with the stream and call ReadBytes to read all the bytes into a byte array. I have a connected socket and I send this byte array
asynchronously over the network. I get the file on my computer but image
data is corrupted. I tried debugging, and found that the values that I have in the byte array are not the same as they are in the file. Rather the
header information of the JPG gets transferred correctly. Since the file was originally on the PC and was downloaded to the emulator by adding it to the project. I assume that the byte values at their corresponding locations
should match with what the byte array contains after loading the file data
on the pocket pc. It does not! For instance the byte #213 is having decimal value 62 on the PC when I see the corresponding index in the byte array it
reads 65. Is this a problem of encoding? Unicode and ASCII? Does it have
anything to do with byte ordering? why is this happening? what is the way
out to provide a simple byte to byte transfer of files from hand-held to PC and from PC to hand-held over the network? Please reply because at this
point I have tried all options and I don't have a way out. I am able to
send textmessages to and fro client and server.

Following is the code snippet of client and server.

Server

FILE *pFile = NULL;//file pointer
BYTE recvbuf[1024];
pFile = fopen(strFileNa me,"w");//opens a file for writing if the file does
exist it will empty it
int bytesRecv = SOCKET_ERROR;//initializes to an error value.
//this a while loop that keep reading bytes till the terminating symbol is
not found in the stream
while( bytesRecv == SOCKET_ERROR || !boTermFound)
{//keep reading and writing bytes till you read the end of the message
bytesRecv = recv(AcceptSock et, (char*)recvbuf, 1024, 0 );
//have to check weather the last n bytes contain the terminator string
if (bytesRecv == 0 || bytesRecv == WSAECONNRESET )
{
AfxMessageBox( "Connection Closed");
return false;
break;
}
boTermFound = CheckForTermina tor(strTermStri ng,recvbuf,byte sRecv);
fwrite(recvbuf, sizeof(BYTE),by tesRecv, pFile);
}
fclose(pFile)

Client (.net compact c#)
-------------------------

FileStream myFileStream;
myFileStream = new
FileStream(m_st rFileName,FileM ode.Open,FileAc cess.Read,FileS hare.Read);//an instance of FileStream
byte[] b = new byte[myFileStream.Le ngth];//create a byte array to store
for(long i=0;i<myFileStr eam.Length;i++)
b[i] = (byte)myFileStr eam.ReadByte();
myFileStream.Cl ose();
_socket.BeginSe nd(b, 0, b.Length,
SocketFlags.Non e, null, null);
// send the terminator
_asyncEvent.Res et();
_socket.BeginSe nd(Network.Term inatorBytes, 0,
Network.Termina torBytes.Length , SocketFlags.Non e, _sendCallback, true);
//this is just code that indicates termination of data.

This is becoming a serious problem. My whole project depends on
succcessfully able to transfer jpg images. Please look into this.

Regards, Abhishek

Nov 15 '05 #5
[As answered in email - please note my signature, which requests that
you *don't* CC me if you're replying to the group as well.]

Abhishek <ga*****@rpi.ed u> wrote:
The code I put down there is slightly different there because
I have been trying all different kind of things and this was
the latest changes I was underway. I have also used the
BinaryReader method and did not work. I know reading byte to
byte is horrendous but right now I want to transfer my data
without any corruption and that is my major concern.

Its is likely that using a terminator string might not be a
good idea but a terminator string wont repeate twice. In my
case I do get the terminator string at the end of the byte
transfer only. So the terminator string is not getting mixed
somewhere in the middle of the data.
It's a bad idea to mix binary data and character data - and a
terminator *string* sounds like character data in the middle of binary
data. A length prefix is definitely a nicer way to go here - it also
means the other end will know how much to expect.

Writing the terminator string asynchronously is *definitely* a bad idea
though.
About the problem being there on the client end or server end
it seems most likely it is the client end. Because I have a
one JPG file which I transfer from the desktop to the pocket
pc. This is the very file I am trying to send back using
sockets. Now the way I am checking this is I am loading the
files in byte array at both ends. The first 213 bytes in the
pocket pc and the desktop are identical but things change
after the 214 byte, its deciamal value on the desktop version
of the file is 62 and its value in the pocket pc version is
65. The character corresponding to 62 is '>' and that is what
it shows when i open the file in binary on the desktop.
So which byte did the Pocket PC send? If it's the correct one, the
problem is on the server. If it's the wrong one, the problem is on the
client.

Again, you need to be very clear of the difference between a byte and a
character. Deal *entirely* in binary terms for this.
Now
from this byte onwards things are no longer identical. Things
get different if not drastically. So what my feeling is that
the pocket pc interprets byte data in a different manner
using a different encoding.
There *are* no encodings involved in binary data - only character data.
But I dont know. I tried loading
the same file on the pocket pc using one file stream and
writing using another filestream and it made a copy of the
image file on the pocket pc so loading of the byte data seems
ok from the pokcet pc environment but is not having the same
correspondance with the byte data on the desktop. I hope I
have answered all your questions. Please give me hints what
to do next?


Write a very simple app to replace the server one, and get it to just
output (in hex) whatever it receives.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #6
Abhishek <ga*****@rpi.ed u> wrote:
So you mean i check for the first occurance of \0 or a repeated sequence of
\0\0\0 ?
You are talking of this in referene to byte transfer or simply ASCII
transfer bec I am able to do text transfer without any problems.


The problem Jeya was talking about isn't your problem here, as you're
writing as many bytes as you're reading.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #7
Jeya <je**@cmtsp.com .sg> wrote:
I had a same kind of problem with my smtp gateway...

I solved th problem by checking termination char and extract the exact data
then send to the filestram to write.

In my case
Reply from smtp server...read [1024] bytes say if the actual data is only 24
bytes .Net will fill with "\0\0\0..." the rest.


No, .NET doesn't fill the rest at all - it leaves it exactly as it was,
and it's up to you to use the return value of Read to see how much has
been read. A lot of IO problems are caused by people assuming that Read
will read *exactly* the number of bytes specified.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #8
Sorry for not noticing that comment in your signature.

I have tried exactly what you said. I removed asynchronous send . I also
removed any terminator strings. At the server end I hardcode the number of
bytes the client was sending for quick prototyping. Now there is no mix of
binary data with character data and there is just one call to send. However,
I still use BinaryReader to read the bytes so the next I will try with the
memory stream but I don't know how that is going to help. One more thing to
note the file on the desktop has the size 40,016 bytes but the when this
file is opened using a file stream object in the pocket pc its length is
41,031 bytes. And finally the size of the file I write after getting data
becomes on the desktop (41,178 bytes).
Another thing to note here is that I am doing all this in a emulator? I hope
there are no known bugs with the emulator concerned to what I am trying to
do.

I don't really see any trouble with the server or server program because the
server is getting the bytes which the client is transferring. I have
debugged and seen that all the byte values that the client is sending is
received by the server with one to one correspondence. but it seams the
client is reading the wrong byte values. because what byte values the client
is reading in the first place does not hold a one to one correspondence
between what byte values the image has on the desktop.

What more do you suggest I can try?
"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
[As answered in email - please note my signature, which requests that
you *don't* CC me if you're replying to the group as well.]

Abhishek <ga*****@rpi.ed u> wrote:
The code I put down there is slightly different there because
I have been trying all different kind of things and this was
the latest changes I was underway. I have also used the
BinaryReader method and did not work. I know reading byte to
byte is horrendous but right now I want to transfer my data
without any corruption and that is my major concern.

Its is likely that using a terminator string might not be a
good idea but a terminator string wont repeate twice. In my
case I do get the terminator string at the end of the byte
transfer only. So the terminator string is not getting mixed
somewhere in the middle of the data.


It's a bad idea to mix binary data and character data - and a
terminator *string* sounds like character data in the middle of binary
data. A length prefix is definitely a nicer way to go here - it also
means the other end will know how much to expect.

Writing the terminator string asynchronously is *definitely* a bad idea
though.
About the problem being there on the client end or server end
it seems most likely it is the client end. Because I have a
one JPG file which I transfer from the desktop to the pocket
pc. This is the very file I am trying to send back using
sockets. Now the way I am checking this is I am loading the
files in byte array at both ends. The first 213 bytes in the
pocket pc and the desktop are identical but things change
after the 214 byte, its deciamal value on the desktop version
of the file is 62 and its value in the pocket pc version is
65. The character corresponding to 62 is '>' and that is what
it shows when i open the file in binary on the desktop.


So which byte did the Pocket PC send? If it's the correct one, the
problem is on the server. If it's the wrong one, the problem is on the
client.

Again, you need to be very clear of the difference between a byte and a
character. Deal *entirely* in binary terms for this.
Now
from this byte onwards things are no longer identical. Things
get different if not drastically. So what my feeling is that
the pocket pc interprets byte data in a different manner
using a different encoding.


There *are* no encodings involved in binary data - only character data.
But I dont know. I tried loading
the same file on the pocket pc using one file stream and
writing using another filestream and it made a copy of the
image file on the pocket pc so loading of the byte data seems
ok from the pokcet pc environment but is not having the same
correspondance with the byte data on the desktop. I hope I
have answered all your questions. Please give me hints what
to do next?


Write a very simple app to replace the server one, and get it to just
output (in hex) whatever it receives.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 15 '05 #9
Abhishek <ga*****@rpi.ed u> wrote:
Sorry for not noticing that comment in your signature.

I have tried exactly what you said. I removed asynchronous send . I also
removed any terminator strings. At the server end I hardcode the number of
bytes the client was sending for quick prototyping. Now there is no mix of
binary data with character data and there is just one call to send. However,
I still use BinaryReader to read the bytes so the next I will try with the
memory stream but I don't know how that is going to help. One more thing to
note the file on the desktop has the size 40,016 bytes but the when this
file is opened using a file stream object in the pocket pc its length is
41,031 bytes.
Right. That's the first thing to fix then. How did you get the image to
the desktop in the first place?
And finally the size of the file I write after getting data
becomes on the desktop (41,178 bytes).
It sounds like *something* is still doing things incorrectly,
certainly.
Another thing to note here is that I am doing all this in a emulator? I hope
there are no known bugs with the emulator concerned to what I am trying to
do.
I shouldn't think so.
I don't really see any trouble with the server or server program because the
server is getting the bytes which the client is transferring. I have
debugged and seen that all the byte values that the client is sending is
received by the server with one to one correspondence. but it seams the
client is reading the wrong byte values. because what byte values the client
is reading in the first place does not hold a one to one correspondence
between what byte values the image has on the desktop.

What more do you suggest I can try?


I suggest you write a short but complete program (one for each side)
which demonstrates the problem (and nothing else). If you then mail me
a sample image which gives you problems, I'll have a look and try to
reproduce it. If I can reproduce it, I can have a good crack at fixing
it.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
8668
by: Lingyun Yang | last post by:
*** post for FREE via your newsreader at post.newsfeed.com *** Dear all, I have a file it's binary data viewed in UltraEdit is EF BB BF 0D 0A 3C ....... I want to read them into a int or long int array byte for example: byte=0xEFBB byte=0xBF0D
11
32593
by: Stephan Steiner | last post by:
Hi Generally, FileInfo fi = new FileInfo(path); long size = fi.Length; gets you the length of a file in bytes. However, when copying files, even while the copy operation is still in progress, the filesize, as indicated in Windows Explorer or derived with the above two lines of code, will be the size of the file once the copy operation has completed. Is there a way to
8
7587
by: Xarky | last post by:
Hi, I am downloading a GIF file(as a mail attachement) with this file format, Content-Transfer-Encoding: base64; Now I am writing the downloaded data to a file with this technique: streamWriter = new StreamWriter(@startupPath+"\\"+filename, false); streamWriter.WriteLine(data); I am not specifying any file Encoding. When I try to open the file
15
4786
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update button will verify the information that has been entered and updates the data base if the data is correct. Update will throw an exception if the data is not validate based on some given rules. I also have a custom error handling page to show the...
1
8144
by: Alex | last post by:
Hello, I'm trying to write a little php script to transfert some files from a server to clients (web/http). It's working fin with small files. But transfering big files (try on 1Gb) failed! The transfert is stoped randomly (sometimes at 25%, sometimes at 75%,...). And I don't understand why?! :/
10
10637
by: David | last post by:
I have googled to no avail on getting specifically what I'm looking for. I have found plenty of full blown apps that implement some type of file transfer but what I'm specifcally looking for is an example to follow for using a tcp socket to transfer files between client/server, server/client. Both server and client are my program so I'm not looking for how to implement an FTP client, or how to download a file from a web server via http...
2
3898
by: tedpottel | last post by:
Hi, My program has the following code to transfer a binary file f = open(pathanme+filename,'rb') print "start transfer" self.fthHandle.storbinary('STOR '+filename, f) How can I do an ASCII file transfer?????? -Ted
0
2084
by: fiona | last post by:
Yucca Valley, CA, - October 2007: Catalyst Development Corporation, publisher of SocketTools, SocketWrench and LogicGem, today announced the release of Catalyst File Transfer .NET V5.0. For developers who are creating .NET applications, the File Transfer .NET component offers a comprehensive interface for uploading and downloading files. The Catalyst File Transfer .NET component is a managed code component that is fully compatible with...
6
2788
by: Thom Little | last post by:
I need to transfer an XML file between an application on the client and the server. This would in fact be a copy of the application's .config file. HTML <input form=...would transfer the file but the user would have to select the file and initiate the transfer. I would like the transfer to start under program control and not require the user's interaction. In the past I would simply do a GET or POST transfer of a collection of
0
9855
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9697
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10908
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10587
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10649
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9426
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4487
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4064
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.