🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: chile.comp.programacion
3 messages
3 total messages Started by Pintamono Wed, 08 Jul 2009 21:16
Consulta Socket
#457
Author: Pintamono
Date: Wed, 08 Jul 2009 21:16
41 lines
2504 bytes
Estoy haciendo un servicio que se encarga de conectarse a otro servicio 
via socket, para ello estoy usando el codigo de la pagina de ejemplo de 
microsoft, pero tengo un pequegno problema...

try
            {
                // Establish the remote endpoint for the socket.
                // The name of the 
                // remote device is "host.contoso.com".
                //IPHostEntry ipHostInfo = Dns.GetHostByName("localhost");
                IPAddress ipAddress = 
Dns.GetHostEntry("[IP_DEL_SERVER]").AddressList[0];
                IPEndPoint remoteEP = new IPEndPoint(ipAddress, port);

                // Create a TCP/IP socket.
                Socket client = new Socket(AddressFamily.InterNetwork,
                    SocketType.Stream, ProtocolType.Tcp);

                // Connect to the remote endpoint.
                client.BeginConnect(remoteEP,
                    new AsyncCallback(ConnectCallback), client);
                connectDone.WaitOne();

                // Send test data to the remote device.
                Send(client, psMensaje);
                sendDone.WaitOne();

                // Receive the response from the remote device.
                Receive(client);
                receiveDone.WaitOne();

                // Release the socket.
                client.Shutdown(SocketShutdown.Both);
                client.Close();

            }

se me queda pegado en el "sendDone.WaitOne()", ahi se queda por un rato, 
no cacho si es por mi codigo o porque el servidor no ha contestado nada...

estoy en lo correcto?
Re: Consulta Socket
#458
Author: Rickoj
Date: Thu, 09 Jul 2009 23:58
50 lines
3147 bytes
Pintamono wrote:
> Estoy haciendo un servicio que se encarga de conectarse a otro
> servicio via socket, para ello estoy usando el codigo de la pagina de
> ejemplo de microsoft, pero tengo un pequegno problema...
>
> try
>            {
>                // Establish the remote endpoint for the socket.
>                // The name of the
>                // remote device is "host.contoso.com".
>                //IPHostEntry ipHostInfo =
>                Dns.GetHostByName("localhost"); IPAddress ipAddress =
> Dns.GetHostEntry("[IP_DEL_SERVER]").AddressList[0];
>                IPEndPoint remoteEP = new IPEndPoint(ipAddress, port);
>
>                // Create a TCP/IP socket.
>                Socket client = new Socket(AddressFamily.InterNetwork,
>                    SocketType.Stream, ProtocolType.Tcp);
>
>                // Connect to the remote endpoint.
>                client.BeginConnect(remoteEP,
>                    new AsyncCallback(ConnectCallback), client);
>                connectDone.WaitOne();
>
>                // Send test data to the remote device.
>                Send(client, psMensaje);
>                sendDone.WaitOne();
>
>                // Receive the response from the remote device.
>                Receive(client);
>                receiveDone.WaitOne();
>
>                // Release the socket.
>                client.Shutdown(SocketShutdown.Both);
>                client.Close();
>
>            }
>
> se me queda pegado en el "sendDone.WaitOne()", ahi se queda por un
> rato, no cacho si es por mi codigo o porque el servidor no ha
> contestado nada...
>
> estoy en lo correcto?

seria util que dijeras en que lenguaje, ya que las bolas maginas en este 
momento estan offline, segun entendi mirando lo de microsoft
eso es C#

como ni idea de C#, te dejo este link que no se si lo revisaste o no
http://www.foromsn.com/Version_Imprimible.php?Id=139962
Re: Consulta Socket
#459
Author: Pintamono
Date: Fri, 10 Jul 2009 02:19
61 lines
3273 bytes
Si, gracias, se me olvida lo del lenguaje...

Al parecer es un tema con el servidor remoto, eso lo vamos a ver magnana

Gracias.

"Rick_oj" <rick_oj[sin-esto]@tutopia.com> wrote in message 
news:h3607d$far$1@news.nivel5.cl...
> Pintamono wrote:
>> Estoy haciendo un servicio que se encarga de conectarse a otro
>> servicio via socket, para ello estoy usando el codigo de la pagina de
>> ejemplo de microsoft, pero tengo un pequegno problema...
>>
>> try
>>            {
>>                // Establish the remote endpoint for the socket.
>>                // The name of the
>>                // remote device is "host.contoso.com".
>>                //IPHostEntry ipHostInfo =
>>                Dns.GetHostByName("localhost"); IPAddress ipAddress =
>> Dns.GetHostEntry("[IP_DEL_SERVER]").AddressList[0];
>>                IPEndPoint remoteEP = new IPEndPoint(ipAddress, port);
>>
>>                // Create a TCP/IP socket.
>>                Socket client = new Socket(AddressFamily.InterNetwork,
>>                    SocketType.Stream, ProtocolType.Tcp);
>>
>>                // Connect to the remote endpoint.
>>                client.BeginConnect(remoteEP,
>>                    new AsyncCallback(ConnectCallback), client);
>>                connectDone.WaitOne();
>>
>>                // Send test data to the remote device.
>>                Send(client, psMensaje);
>>                sendDone.WaitOne();
>>
>>                // Receive the response from the remote device.
>>                Receive(client);
>>                receiveDone.WaitOne();
>>
>>                // Release the socket.
>>                client.Shutdown(SocketShutdown.Both);
>>                client.Close();
>>
>>            }
>>
>> se me queda pegado en el "sendDone.WaitOne()", ahi se queda por un
>> rato, no cacho si es por mi codigo o porque el servidor no ha
>> contestado nada...
>>
>> estoy en lo correcto?
>
> seria util que dijeras en que lenguaje, ya que las bolas maginas en este 
> momento estan offline, segun entendi mirando lo de microsoft
> eso es C#
>
> como ni idea de C#, te dejo este link que no se si lo revisaste o no
> http://www.foromsn.com/Version_Imprimible.php?Id=139962
>
>
> 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads