Re: Send TIFF w TransmitFile recv with WSARecv
- From: "Arkady Frenkel" <arkadyf@xxxxxxxxxxxxxxxx>
- Date: Fri, 24 Feb 2006 10:16:28 +0200
Additionally, seems you parser work wrong because you have to receive all
the data ( ascii or not )
Arkady
"JJ" <jj@xxxxxxxxxx> wrote in message
news:elJFALIOGHA.532@xxxxxxxxxxxxxxxxxxxxxxx
Are you calling WSARecv in a loop? You are not guaranteed to receive all
of the data in one call. You have to check l_bytesRecvd to see how much
data was received and keep calling WSRecv until all of the data is
received.
As far as I know, TransmitFile does not care about the data transferred.
Are you writing it to a file on the receiver side? Are you using a file
I/O call on that side that would care about the content?
"Joachim" <Joachim@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:40CE93CD-2BDE-426C-BA44-0616D1ABB9BA@xxxxxxxxxxxxxxxx
I seem only to get the readable (ascii I think) characters when
transfering a
TIFF image file from one computer (using TransmitFile) and receiving on
the
other (using WSARecv) as follows:
Sender:
=========
HANDLE l_hFile = CreateFile("tiffImg.tif, GENERIC_READ, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (l_hFile == INVALID_HANDLE_VALUE)
{
throw MyException();
}
if (TransmitFile(socket, l_hFile, 0, 1023, NULL, NULL, NULL) == FALSE)
{
throw MyException();
}
CloseHandle(l_hFile);
=========
Receiver:
=========
const unsigned int l_recvBufLen = 1024;
char l_buf[l_recvBufLen];
memset(l_buf, 0, l_recvBufLen);
WSABUF WSAbuf;
WSAbuf.buf = l_buf;
WSAbuf.len = l_recvBufLen - 1;
DWORD l_flags = 0;
DWORD l_bytesRecvd;
WSARecv(clientSock, &WSAbuf, 1, &l_bytesRecvd, &l_flags, &l_overlapped,
NULL);
=========
Any ideas of the cause and how I can solve the problem? I suspect I
should
receive the data in another way, but I don't know how.
.
- References:
- Prev by Date: Re: DFS Client NetDfs API in MSDN - NetDfsSetClientInfo
- Next by Date: Re: WMI/COM and ExecNotificationQueryAsync for Win32_NTLogEvent
- Previous by thread: Re: Send TIFF w TransmitFile recv with WSARecv
- Next by thread: Re: remotedesktop & socket
- Index(es):
Relevant Pages
|