CSocket

20/04/2004 - 18:04 por Iker Landajuela | Informe spam
Hola, estoy realizando una aplicacion cliente en Embedded Visual C++ basada
en CSocket, cuando intento enviar datos aparece la conexion en mi aplicacion
servidor pero no consigo mandar datos debido a un error de timeout (numero
10060), esto solo ocurre a veces, otra veces manda bien, pero el problema es
que cuando seproduce un error de timeout este error se reproduce en
sucesivos intentos y no consigo mandar nada, alguien podria orientarme por
favor?
gracias.

Preguntas similare

Leer las respuestas

#1 mohit9814
11/05/2004 - 08:29 | Informe spam
hi,
I am havin a tough time using Csocket class.
I'm tryin to create a Client and a Server using Csocket in a CONSOLE
app'n

SERVER App'n
-
class CListeningSocket:public CSocket
{
void CListeningSocket::OnAccept (int nErrorCode)
{
cout<<" Listenin Socket's OnAccept Function Called"<<endl; // does
not get triggered ?
CSocket::OnAccept(nErrorCode);
}

}

CListeningSocket ListeningSocket;

ListeningSocket.Create (PORT_NUMBER,SOCK_STREAM);
ListeningSocket.Listen ();

while(1)
{
Sleep(100); // wait for client to send ACCEPT notification
}
/////////////////

Also can u tell me how to find out whether the connectionis present or
not ( on Client OR Server side)

any suggections ?
thanx in advance...
Respuesta Responder a este mensaje
#2 John McCabe
11/05/2004 - 11:10 | Informe spam
On 10 May 2004 23:29:40 -0700, (Mohit) wrote:

hi,
I am havin a tough time using Csocket class.
I'm tryin to create a Client and a Server using Csocket in a CONSOLE
app'n

SERVER App'n
-
class CListeningSocket:public CSocket
{
void CListeningSocket::OnAccept (int nErrorCode)
{
cout<<" Listenin Socket's OnAccept Function Called"<<endl; // does
not get triggered ?
CSocket::OnAccept(nErrorCode);
}

}

CListeningSocket ListeningSocket;

ListeningSocket.Create (PORT_NUMBER,SOCK_STREAM);
ListeningSocket.Listen ();

while(1)
{
Sleep(100); // wait for client to send ACCEPT notification
}
/////////////////

Also can u tell me how to find out whether the connectionis present or
not ( on Client OR Server side)

any suggections ?
thanx in advance...



What version of Windows CE are you developing for?

Do any of the following matches on Google help?

http://groups.google.com/groups?q=c...amp;tab=wg


Best Regards
John McCabe

To reply by email replace 'nospam' with 'assen'
Respuesta Responder a este mensaje
#3 Paul G. Tobey [eMVP]
11/05/2004 - 17:55 | Informe spam
My everlasting advice is to forget that CSocket ever existed and just use
WinSock. People are always finding things that they can't get to work with
CSocket, but hardly ever have problems with WinSock...

Paul T.

"John McCabe" wrote in message
news:
On 10 May 2004 23:29:40 -0700, (Mohit) wrote:

>hi,
>I am havin a tough time using Csocket class.
>I'm tryin to create a Client and a Server using Csocket in a CONSOLE
>app'n
>
>SERVER App'n
>-
>class CListeningSocket:public CSocket
>{
> void CListeningSocket::OnAccept (int nErrorCode)
> {
> cout<<" Listenin Socket's OnAccept Function Called"<<endl; // does
>not get triggered ?
> CSocket::OnAccept(nErrorCode);
> }
>
>}
>
>CListeningSocket ListeningSocket;
>
>ListeningSocket.Create (PORT_NUMBER,SOCK_STREAM);
>ListeningSocket.Listen ();
>
>while(1)
>{
> Sleep(100); // wait for client to send ACCEPT notification
>}
>/////////////////
>
>Also can u tell me how to find out whether the connectionis present or
>not ( on Client OR Server side)
>
>any suggections ?
>thanx in advance...

What version of Windows CE are you developing for?

Do any of the following matches on Google help?




http://groups.google.com/groups?q=c...amp;tab=wg


Best Regards
John McCabe

To reply by email replace 'nospam' with 'assen'
Respuesta Responder a este mensaje
#4 John McCabe
12/05/2004 - 12:32 | Informe spam
On Tue, 11 May 2004 08:55:29 -0700, "Paul G. Tobey [eMVP]"
wrote:

My everlasting advice is to forget that CSocket ever existed and just use
WinSock. People are always finding things that they can't get to work with
CSocket, but hardly ever have problems with WinSock...



That does make some sense, but then you have to know a hell of a lot
more about managing asynchronous notifications etc. Good things to
know though!


Best Regards
John McCabe

To reply by email replace 'nospam' with 'assen'
Respuesta Responder a este mensaje
#5 Paul G. Tobey [eMVP]
12/05/2004 - 17:07 | Informe spam
Or about threading, maybe. I think that the main problem with the MFC
socket stuff is that it was all implemented with some significant
assumptions in place which turn out not to be true in a lot of cases (at
least it seems that way to me). If you need some sort of asynchronous
notification of a window procedure or something, it's pretty easy to do that
from a thread which is in charge of handling the socket I/O. The hardest
thing, if you set up your program that way, is arranging for the thread to
exit when the user closes the program (which isn't too hard).

I'm pretty sure that you'll find yourself closer to a working program faster
if you drop CSocket.

Paul T.

"John McCabe" wrote in message
news:
On Tue, 11 May 2004 08:55:29 -0700, "Paul G. Tobey [eMVP]"
wrote:

>My everlasting advice is to forget that CSocket ever existed and just use
>WinSock. People are always finding things that they can't get to work


with
>CSocket, but hardly ever have problems with WinSock...

That does make some sense, but then you have to know a hell of a lot
more about managing asynchronous notifications etc. Good things to
know though!


Best Regards
John McCabe

To reply by email replace 'nospam' with 'assen'
email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida