G
Guest
Hello Developpers,
I faced with a problem during developping a TCP/IP Client application. The Client application will receive intensive data from Server. Client is receiving data by using the recv(...) functions, as normal. My code is as follows:
----------
public __gc class Form1 : public System::Windows::Forms::Form
{
....
public:
#define Max_Buffer_Size 50000
SOCKET ClientSocket;
......
private:
void trd_Recv_Task()
{
....
char* recvBuf = new char[Max_Buffer_Size];
int retRecvVal = recv(ClientSocket , recvBuf , Max_Buffer_Size , 0);
.....
}
....
}
------------
During this receiving, I noticed that I could not receive more than 2048 Bytes (2KB) once at a time. In my first version of code, I was taking data from Server, then, doing operations depending on the received data. But once, receiving data were more than 2KB, and I could not take then rest of my working codes gave erros.
I changed my technique now. First, I receive only a 2 bytes of data that says me the size of the following receiving in integer format. Then I run the recv(...) function in a while(...) loop, till the expected number of bytes are received. The rest is working.
As a note, I am using MS Visual C++ .NET Standard on Windows 2000 Professional O.S.
I searched over internet about how to resize the recv( ) buffer. I understood that TCPWindowSize is the point that I have to work on. Or there are some other settings that I don't know now.
If you may guide me about resizing the recv(...) buffer, I will be so happy.
Respectfully, yours
Alper
I faced with a problem during developping a TCP/IP Client application. The Client application will receive intensive data from Server. Client is receiving data by using the recv(...) functions, as normal. My code is as follows:
----------
public __gc class Form1 : public System::Windows::Forms::Form
{
....
public:
#define Max_Buffer_Size 50000
SOCKET ClientSocket;
......
private:
void trd_Recv_Task()
{
....
char* recvBuf = new char[Max_Buffer_Size];
int retRecvVal = recv(ClientSocket , recvBuf , Max_Buffer_Size , 0);
.....
}
....
}
------------
During this receiving, I noticed that I could not receive more than 2048 Bytes (2KB) once at a time. In my first version of code, I was taking data from Server, then, doing operations depending on the received data. But once, receiving data were more than 2KB, and I could not take then rest of my working codes gave erros.
I changed my technique now. First, I receive only a 2 bytes of data that says me the size of the following receiving in integer format. Then I run the recv(...) function in a while(...) loop, till the expected number of bytes are received. The rest is working.
As a note, I am using MS Visual C++ .NET Standard on Windows 2000 Professional O.S.
I searched over internet about how to resize the recv( ) buffer. I understood that TCPWindowSize is the point that I have to work on. Or there are some other settings that I don't know now.
If you may guide me about resizing the recv(...) buffer, I will be so happy.
Respectfully, yours
Alper