🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: chile.comp.programacion
Article #458

Re: Consulta Socket

#458
From: 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
Technical Details
Message-ID: <h3607d$far$1@news.nivel5.cl>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!news.glorb.com!news2.glorb.com!news-xfer.nntp.sonic.net!news.kjsl.com!news.nivel5.cl!not-for-mail
References: <c0e93edb27cb050e7824e729c995d4a0$1@usenet.no-ip.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: e499fe1f24,69afe79b0d04a827
X-Google-Attributes: gide499fe1f24,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!news.glorb.com!news2.glorb.com!news-xfer.nntp.sonic.net!news.kjsl.com!news.nivel5.cl!not-for-mail
From: "Rick_oj" <rick_oj[sin-esto]@tutopia.com>
Newsgroups: chile.comp.programacion
Subject: Re: Consulta Socket
Date: Thu, 9 Jul 2009 19:58:39 -0400
Organization: Varios
Lines: 53
Message-ID: <h3607d$far$1@news.nivel5.cl>
References: <c0e93edb27cb050e7824e729c995d4a0$1@usenet.no-ip.com>
NNTP-Posting-Host: pc-51-70-160-190.cm.vtr.net
X-Trace: news.nivel5.cl 1247183917 15707 190.160.70.51 (9 Jul 2009 23:58:37 GMT)
X-Complaints-To: news@news.nivel5.cl
NNTP-Posting-Date: Thu, 9 Jul 2009 23:58:37 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-Antivirus: avast! (VPS 090709-0, 09/07/2009), Outbound message
X-Antivirus-Status: Clean