Hi,
I am trying to transfer data from a Unix machine to Windows machine
using C Network functions.
In unix i send image data to windows using send() function in a loop
running till the end of image data (length is known beforehand). sending 1022
bytes at a time
when i send binary image data, i use recv command in windows to get data
1022 bytes at a time.it works fine.
But when i try to send JPEG image data. Only the first 4 bytes of JPEG
header (FF D8 FF E0) are received. the rest of the 1018 bytes are not
received, in the next send(), transmission starts from 1023 bytes after the
start of image data, from this point on data is transmitted and received
correctly.
I have observed that if Image data has consecutive zeros - 00 i.e 0x30
0x30. Data is either not read by recv() or transmitted by send() [i actually
dont know which command is at fault since both return 1022 bytes data
read/written].
Any help will be greatly appreciated.
thanks and regards 5 1145
Actually i figured out the problem, I am using a String Array to write data
from Image file and am using this String Array to transmit data using Send().
The 00 is a NULL character in C and when encountered in the array C thinks
the Array has ended.
But the JPEG image data i want to transfer contains a lot of NULL characters
(viewed using Hex editor), and i want to transfer the data through the
network. How can I use a BYTE Array in C? Any suggestions?
"Pravin Prabhu" wrote: Hi, I am trying to transfer data from a Unix machine to Windows machine using C Network functions.
In unix i send image data to windows using send() function in a loop running till the end of image data (length is known beforehand). sending 1022 bytes at a time
when i send binary image data, i use recv command in windows to get data 1022 bytes at a time.it works fine. But when i try to send JPEG image data. Only the first 4 bytes of JPEG header (FF D8 FF E0) are received. the rest of the 1018 bytes are not received, in the next send(), transmission starts from 1023 bytes after the start of image data, from this point on data is transmitted and received correctly. I have observed that if Image data has consecutive zeros - 00 i.e 0x30 0x30. Data is either not read by recv() or transmitted by send() [i actually dont know which command is at fault since both return 1022 bytes data read/written].
Any help will be greatly appreciated.
thanks and regards
Are you using Winsock? Or some higher level wrapper library?
If you are using Winsock, the 3rd parameter to send() is the length in bytes
of the byte array (2nd parameter).
--
Regards,
Nish [VC++ MVP] http://www.voidnish.com http://blog.voidnish.com
"Pravin Prabhu" <Pr**********@discussions.microsoft.com> wrote in message
news:94**********************************@microsof t.com... Actually i figured out the problem, I am using a String Array to write data from Image file and am using this String Array to transmit data using Send(). The 00 is a NULL character in C and when encountered in the array C thinks the Array has ended. But the JPEG image data i want to transfer contains a lot of NULL characters (viewed using Hex editor), and i want to transfer the data through the network. How can I use a BYTE Array in C? Any suggestions?
"Pravin Prabhu" wrote:
Hi, I am trying to transfer data from a Unix machine to Windows machine using C Network functions.
In unix i send image data to windows using send() function in a loop running till the end of image data (length is known beforehand). sending 1022 bytes at a time
when i send binary image data, i use recv command in windows to get data 1022 bytes at a time.it works fine. But when i try to send JPEG image data. Only the first 4 bytes of JPEG header (FF D8 FF E0) are received. the rest of the 1018 bytes are not received, in the next send(), transmission starts from 1023 bytes after the start of image data, from this point on data is transmitted and received correctly. I have observed that if Image data has consecutive zeros - 00 i.e 0x30 0x30. Data is either not read by recv() or transmitted by send() [i actually dont know which command is at fault since both return 1022 bytes data read/written].
Any help will be greatly appreciated.
thanks and regards
Hi Nishanth,
I am using Winsock on the windows side for recv().
Actually the send() command is in the unix side. I do give
the Length of the array (1022 bytes). but the problem is that there is a null
character at the 5th position of the array. There are a lot of null
characters in the image data stored in the array. Since NULL is the end of
string in C, i am facing problems sending the whole image data.
"Nishant Sivakumar" wrote: Are you using Winsock? Or some higher level wrapper library?
If you are using Winsock, the 3rd parameter to send() is the length in bytes of the byte array (2nd parameter).
-- Regards, Nish [VC++ MVP] http://www.voidnish.com http://blog.voidnish.com
"Pravin Prabhu" <Pr**********@discussions.microsoft.com> wrote in message news:94**********************************@microsof t.com... Actually i figured out the problem, I am using a String Array to write data from Image file and am using this String Array to transmit data using Send(). The 00 is a NULL character in C and when encountered in the array C thinks the Array has ended. But the JPEG image data i want to transfer contains a lot of NULL characters (viewed using Hex editor), and i want to transfer the data through the network. How can I use a BYTE Array in C? Any suggestions?
"Pravin Prabhu" wrote:
Hi, I am trying to transfer data from a Unix machine to Windows machine using C Network functions.
In unix i send image data to windows using send() function in a loop running till the end of image data (length is known beforehand). sending 1022 bytes at a time
when i send binary image data, i use recv command in windows to get data 1022 bytes at a time.it works fine. But when i try to send JPEG image data. Only the first 4 bytes of JPEG header (FF D8 FF E0) are received. the rest of the 1018 bytes are not received, in the next send(), transmission starts from 1023 bytes after the start of image data, from this point on data is transmitted and received correctly. I have observed that if Image data has consecutive zeros - 00 i.e 0x30 0x30. Data is either not read by recv() or transmitted by send() [i actually dont know which command is at fault since both return 1022 bytes data read/written].
Any help will be greatly appreciated.
thanks and regards
You are trying to use null-terminated strings to store binary data. That's
your basic problem.
Instead use a char array [but do not use any string manipulation functions
on it] or use a void* instead. And then use the Buffer-Manipulation Routines
like memcpy, memcmp etc.
--
Regards,
Nish [VC++ MVP] http://www.voidnish.com http://blog.voidnish.com
"Pravin Prabhu" <Pr**********@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com... Hi Nishanth, I am using Winsock on the windows side for recv(). Actually the send() command is in the unix side. I do give the Length of the array (1022 bytes). but the problem is that there is a null character at the 5th position of the array. There are a lot of null characters in the image data stored in the array. Since NULL is the end of string in C, i am facing problems sending the whole image data.
"Nishant Sivakumar" wrote:
Are you using Winsock? Or some higher level wrapper library?
If you are using Winsock, the 3rd parameter to send() is the length in bytes of the byte array (2nd parameter).
-- Regards, Nish [VC++ MVP] http://www.voidnish.com http://blog.voidnish.com
"Pravin Prabhu" <Pr**********@discussions.microsoft.com> wrote in message news:94**********************************@microsof t.com... > Actually i figured out the problem, I am using a String Array to write > data > from Image file and am using this String Array to transmit data using > Send(). > The 00 is a NULL character in C and when encountered in the array C > thinks > the Array has ended. > But the JPEG image data i want to transfer contains a lot of NULL > characters > (viewed using Hex editor), and i want to transfer the data through the > network. How can I use a BYTE Array in C? Any suggestions? > > "Pravin Prabhu" wrote: > >> Hi, >> I am trying to transfer data from a Unix machine to Windows >> machine >> using C Network functions. >> >> In unix i send image data to windows using send() function in a >> loop >> running till the end of image data (length is known beforehand). >> sending >> 1022 >> bytes at a time >> >> when i send binary image data, i use recv command in windows to >> get >> data >> 1022 bytes at a time.it works fine. >> But when i try to send JPEG image data. Only the first 4 bytes of >> JPEG >> header (FF D8 FF E0) are received. the rest of the 1018 bytes are not >> received, in the next send(), transmission starts from 1023 bytes >> after >> the >> start of image data, from this point on data is transmitted and >> received >> correctly. >> I have observed that if Image data has consecutive zeros - 00 i.e >> 0x30 >> 0x30. Data is either not read by recv() or transmitted by send() [i >> actually >> dont know which command is at fault since both return 1022 bytes data >> read/written]. >> >> Any help will be greatly appreciated. >> >> thanks and regards
Hi Nishant,
Actually I am storing (binary) Image data which i obtain from
an imaging device in a Char Array. The Image data already has lots of null
characters as part of image data, so when i copy into a char array it
automatically becomes a null terminated string. and when i try to transmit
the Char array i face problems.
"Nishant Sivakumar" wrote: You are trying to use null-terminated strings to store binary data. That's your basic problem.
Instead use a char array [but do not use any string manipulation functions on it] or use a void* instead. And then use the Buffer-Manipulation Routines like memcpy, memcmp etc.
-- Regards, Nish [VC++ MVP] http://www.voidnish.com http://blog.voidnish.com
"Pravin Prabhu" <Pr**********@discussions.microsoft.com> wrote in message news:7F**********************************@microsof t.com... Hi Nishanth, I am using Winsock on the windows side for recv(). Actually the send() command is in the unix side. I do give the Length of the array (1022 bytes). but the problem is that there is a null character at the 5th position of the array. There are a lot of null characters in the image data stored in the array. Since NULL is the end of string in C, i am facing problems sending the whole image data.
"Nishant Sivakumar" wrote:
Are you using Winsock? Or some higher level wrapper library?
If you are using Winsock, the 3rd parameter to send() is the length in bytes of the byte array (2nd parameter).
-- Regards, Nish [VC++ MVP] http://www.voidnish.com http://blog.voidnish.com
"Pravin Prabhu" <Pr**********@discussions.microsoft.com> wrote in message news:94**********************************@microsof t.com... > Actually i figured out the problem, I am using a String Array to write > data > from Image file and am using this String Array to transmit data using > Send(). > The 00 is a NULL character in C and when encountered in the array C > thinks > the Array has ended. > But the JPEG image data i want to transfer contains a lot of NULL > characters > (viewed using Hex editor), and i want to transfer the data through the > network. How can I use a BYTE Array in C? Any suggestions? > > "Pravin Prabhu" wrote: > >> Hi, >> I am trying to transfer data from a Unix machine to Windows >> machine >> using C Network functions. >> >> In unix i send image data to windows using send() function in a >> loop >> running till the end of image data (length is known beforehand). >> sending >> 1022 >> bytes at a time >> >> when i send binary image data, i use recv command in windows to >> get >> data >> 1022 bytes at a time.it works fine. >> But when i try to send JPEG image data. Only the first 4 bytes of >> JPEG >> header (FF D8 FF E0) are received. the rest of the 1018 bytes are not >> received, in the next send(), transmission starts from 1023 bytes >> after >> the >> start of image data, from this point on data is transmitted and >> received >> correctly. >> I have observed that if Image data has consecutive zeros - 00 i.e >> 0x30 >> 0x30. Data is either not read by recv() or transmitted by send() [i >> actually >> dont know which command is at fault since both return 1022 bytes data >> read/written]. >> >> Any help will be greatly appreciated. >> >> thanks and regards This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Matthias Stock |
last post by:
Hello,
i want to simulate a transmission network. Therefore I must create some
blocks, e.g. random integer generator, AWGN, etc.
Does anyone...
|
by: Kim Hamilton |
last post by:
Hello,
I'm using a C++ program to write out a file using sopen(). The file is
pointed to a network drive. Some times the network goes down, and...
|
by: Bekkali Hicham |
last post by:
hi,
i have already used xalan several times with success, but i have a error
message that i don't understand, thanks for your help
(Emplacement...
|
by: James Fortune |
last post by:
In order to get the records I want on a report I sometimes create a
SQL string for the RecordSource and sometimes supply the criteria
using the...
|
by: Leonardo D'Ippolito |
last post by:
Hi!
I have two .NET win apps that need to communicate on a TCP/IP network.
'App A' must ask 'app B' if it's allowed to do some task, and 'app B'...
|
by: Sammy |
last post by:
I am using the following code on a company that hosts our web site. I have
noticed lately that their mail server/smtp is unavailable several times a...
|
by: Bgreer5050 |
last post by:
I keep getting the following error on an asp form I have on my site. I know
the smtp settings are correct, because if I take out the user fields...
|
by: parez |
last post by:
Hi,
When does the socket (server) know when to stop reading.
e.g.
if i have a buffer = 25K
and do networkStream.write twice.. what will...
|
by: mariuchp |
last post by:
Can somebody help me. Is it a good method to transfer large data accros network? The query returns about 1 milion rows, and I must transfer them to...
|
by: better678 |
last post by:
Question:
Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct?
Answer:
Java is an object-oriented...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was...
|
by: Matthew3360 |
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the...
| |