Hello everybody:
I am writing a nonMFC server application using winsock2, first of all, i must tell that i have 2 classes, CServer and CServerClient...i have created one server instance listening on a port, and when a client arrives, the server creates a thread and put an instance of the client in the thread, all this seems to work well, but the problem is that every client receive data and put that data into a file, (for example if i had 4 clients y would have 4 files), the problem is that when i send a big amount of data (for example 890 kb) it works really really slow.
I receive the data one character at time, when i got an entire line, then i write in the file....i dont know if there is another way that can improve the transmission of data, i tried to use a big buffer on recv command, but for example if i connect to mi server using a telnet window, i start receivng the data character by character!! i hope somebody can help me with this...

//here is the client code who receive the data
while(1)
{
do{ // reading a line
if(recv(this->hndSocket, Mibuff,1, 0) == SOCKET_ERROR)
break;
strncat(line, Mibuff, 1); //Mibuff is char[5]
//line is char[1024]
}while (Mibuff[0] != '\n');

if (Mibuff[0] == '\n') {
//here comes the writing on the file, line by line
//and the memset of line and mibuff, to go on in the while
//
}


On the other hand, my server is supposed to handle a big amount of connections, and i think that my way of creating the threads is insufficient to handle a lot of connections, i dont even know how many sockets connections you can open, i hear that you can only open 255 sockets but im not sure of that, i hope somebody can tell me how can i improve mi connection pool

//this code is placed in a function called, acceptconnection()
//this function belong to the server class

LPVOID dwThrdParam;
ServerClient * client;
client = new ServerClient;
client->hndSocket = socAceptado;
dwThrdParam = client;
hThread = CreateThread(
NULL, // no security attributes
0, // use default stack size
ThreadFunc, // thread function
dwThrdParam, // argument to thread function
0, // use default creation flags
&dwThreadId); // returns the thread identifier

//as you can see i am passing the client containing the accepted
//socket handle


Well, i hope mi question is clear and hope to hear form you soon
Greetings

Kcires