Click here to Skip to main content
15,923,689 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: drawing a cercle by code Pin
Hamid_RT8-Apr-08 7:08
Hamid_RT8-Apr-08 7:08 
GeneralHelp with my c programming language Pin
mvayder6-Apr-08 7:47
mvayder6-Apr-08 7:47 
GeneralRe: Help with my c programming language Pin
bob169726-Apr-08 8:27
bob169726-Apr-08 8:27 
GeneralRe: Help with my c programming language Pin
CPallini6-Apr-08 21:42
mveCPallini6-Apr-08 21:42 
Generalwin32 dialogs... Pin
Member 38254936-Apr-08 2:48
Member 38254936-Apr-08 2:48 
GeneralRe: win32 dialogs... Pin
Mark Salsbery6-Apr-08 7:47
Mark Salsbery6-Apr-08 7:47 
QuestionAny way to refresh a CHtmlView without it scrolling back to the top? Pin
Taka Muraoka6-Apr-08 0:43
Taka Muraoka6-Apr-08 0:43 
QuestionWSAENOBUFS error Pin
itai shmida5-Apr-08 23:01
itai shmida5-Apr-08 23:01 
Hello.

I have an application that uses TCP Sockects to see if a port is alive
or dead.
For this I use a thread for every TCP-Ping that I do.
In each thread I open a socket and try to execute a blocking Connect
command.
I test this application on a list of 2000 IP:Port devices
The application tries this TCP-Ping for all these devices in every 10
minutes.
After about 6 hours, on every Connect attempt I get the WSAENOBUFS
error.
Also my computer seems to stuck.
Only if I kill the aplications process - the computer recovers and I
can run this aplication again for another 6 hours.

I tried almost everything to change the TCP parameters through the
registry, and also to kill and free the socket.
Here is the sample code of the thread:

WSAStartup( MAKEWORD(2,2), &wsaData );
m_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if ( m_socket == INVALID_SOCKET )
{
       LogMsg.Format("ERROR socket INVALID_SOCKET: %d", WSAGetLastError());
       WSACleanup();
       hr = E_FAIL;
       return hr;
}
clientService.sin_family        = AF_INET;
clientService.sin_addr.s_addr   = inet_addr(IpAddress);
clientService.sin_port          = htons(Port);

// connect the socket to the IP:Port - a blocking connect
rc = connect(m_socket, (SOCKADDR*) &clientService, sizeof(SOCKADDR));
if (rc == SOCKET_ERROR)
{
       LogMsg.Format("ERROR connect SOCKET_ERROR: %d", WSAGetLastError());
       LOG_OUTPUT(LogMsg.GetBuffer());
       hr = E_FAIL;
}
else
{
       hr = S_OK;
       shutdown(m_socket, SD_BOTH);
}
CancelIo((HANDLE)m_socket);
closesocket(m_socket);
WSACleanup();
return hr;
I don't understand why I have this error - it seems like after a
period of time the TCP buffer is filled although I don't use any TCP
command that takes TCP buffer (only createSocket and Connect), does
these commands take TCP buffer? how do I free the buffer?
After finishing this code, the thread exits.
I also tried to use the Select, WSAEventSelect, CreateIoCompletionPort
commands with a non-blocking socket and had the same results.

Can anyone help me?
QuestionRe: WSAENOBUFS error [modified] Pin
Eytukan6-Apr-08 0:50
Eytukan6-Apr-08 0:50 
GeneralRe: WSAENOBUFS error Pin
Mark Salsbery6-Apr-08 8:19
Mark Salsbery6-Apr-08 8:19 
GeneralRe: WSAENOBUFS error Pin
itai shmida13-Apr-08 19:35
itai shmida13-Apr-08 19:35 
Generaldefragmenttation disk by c++ Pin
th875-Apr-08 22:18
th875-Apr-08 22:18 
AnswerRe: defragmenttation disk by c++ Pin
Rajesh R Subramanian5-Apr-08 22:31
professionalRajesh R Subramanian5-Apr-08 22:31 
GeneralSocket programming in C Pin
ADTC#5-Apr-08 14:33
ADTC#5-Apr-08 14:33 
GeneralRe: Socket programming in C [modified] Pin
rp_suman5-Apr-08 15:10
rp_suman5-Apr-08 15:10 
GeneralRe: Socket programming in C Pin
ADTC#5-Apr-08 15:39
ADTC#5-Apr-08 15:39 
QuestionRe: Socket programming in C Pin
rp_suman5-Apr-08 16:50
rp_suman5-Apr-08 16:50 
GeneralRe: Socket programming in C Pin
ADTC#5-Apr-08 16:53
ADTC#5-Apr-08 16:53 
GeneralRe: Socket programming in C [modified] Pin
rp_suman5-Apr-08 17:03
rp_suman5-Apr-08 17:03 
GeneralRe: Socket programming in C Pin
CPallini6-Apr-08 1:36
mveCPallini6-Apr-08 1:36 
GeneralRe: Socket programming in C Pin
Eytukan5-Apr-08 18:03
Eytukan5-Apr-08 18:03 
AnswerRe: Socket programming in C Pin
Himanshu Joshi5-Apr-08 18:35
Himanshu Joshi5-Apr-08 18:35 
Questioncapturing keyboard inputs Pin
Adnan Merter5-Apr-08 13:09
Adnan Merter5-Apr-08 13:09 
GeneralRe: capturing keyboard inputs Pin
Mark Salsbery5-Apr-08 13:18
Mark Salsbery5-Apr-08 13:18 
GeneralRe: capturing keyboard inputs Pin
Adnan Merter5-Apr-08 13:21
Adnan Merter5-Apr-08 13:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.