🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: chile.comp.programacion
Article #457

Consulta Socket

#457
From: 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?
Technical Details
Message-ID: <c0e93edb27cb050e7824e729c995d4a0$1@usenet.no-ip.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!news.kjsl.com!news.nivel5.cl!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: e499fe1f24,69afe79b0d04a827,start
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!news.glorb.com!news.kjsl.com!news.nivel5.cl!not-for-mail
From: pintamono@NoMandeWeas.kk (Pintamono)
Newsgroups: chile.comp.programacion
Subject: Consulta Socket
Date: Wed, 08 Jul 2009 18:16:47 -0300
Organization: Usenet Chile.* http://usenet.no-ip.com
Lines: 42
Message-ID: <c0e93edb27cb050e7824e729c995d4a0$1@usenet.no-ip.com>
NNTP-Posting-Host: pc-231-67-239-201.cm.vtr.net
Mime-Version: 1.0
X-Trace: news.nivel5.cl 1247087812 6847 201.239.67.231 (8 Jul 2009 21:16:52 GMT)
X-Complaints-To: news@news.nivel5.cl
NNTP-Posting-Date: Wed, 8 Jul 2009 21:16:52 +0000 (UTC)
User-Agent: NewsPortal/0.3X RCL MOD
X-Abuse: robertocl@gmail.com
X-HTTP-Posting-Host: 201.238.215.146