Asynchronous Socket Error 10049
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn delphi asynchronous socket error 10049 more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags
Windows Socket Error 10049
Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like
Socket Error Errno 10049
you, helping each other. Join them; it only takes a minute: Sign up getting asynchronous socket error 10049 even if i use try..except up vote 3 down vote favorite when ever i run my program(outside the debugger/ide) i
Asynchronous Socket Error 10061
get error asynchronous socket error 10049, am i not supposed to recieve a message dialoge : ''error''? see my code below begin try ClientSocket1.open; except showmessage('error'); end; end; what am i doing wrong? delphi sockets exception-handling try-finally tclientsock share|improve this question asked Aug 1 '10 at 16:09 Omair Iqbal 1,0501639 add a comment| 2 Answers 2 active oldest votes up vote 4 down vote accepted What you should do is handle the Error event of the asynchronous socket error 10053 TClientSocket, because that is where you will be able to capture your socket errors. The ErrorCode parameter is the one that will have the WinSock Error code If you want to silence the Error, you can set ErrorCode to 0, which will prevent the exception from being thrown, and after that you can identify what the error is and handle it the way you want it procedure TForm1.ClientSocket1Error(Sender: TObject; Socket: TCustomWinSocket; ErrorEvent: TErrorEvent; var ErrorCode: Integer); var error : Integer; begin error := ErrorCode; {prevent exception from being thrown} ErrorCode := 0; if error = 10049 then showmessage('asynchronous socket error'); . . . end; I hope this helps Gaetan Siry share|improve this answer answered Aug 1 '10 at 19:59 G-Man 3,570124575 thanks a heap.... –Omair Iqbal Aug 2 '10 at 6:13 add a comment| up vote -1 down vote The TClientsocket component (which is deprecated for a while already) uses the asynchronous communication model, so it is possible that the exception is not thrown in the Open method but in the message / event handling method which receives the incoming data. update: I can reproduce this with Delphi 6 and the given code, if I enter an invalid IP address like 1.2.3.4 To fix it I would move to a TCP/IP library like Indy or Ararat Synapse (both have a generic TCP cli
by CloudFlare Ray ID: 2eb0470e74da0528
[0] Подскажите пожайлуста, вот сделал одну форму занес на нее сервер сокет и кнопку, поле мемо еще, на событие он клик кнопки procedure TForm1.Button1Click(Sender: TObject); begin serverSocket1.active:=true; edit1.text:="Active"; end; http://delphimaster.net/view/6-52318 на событие OnClientRead: procedure TForm1.ServerSocket1ClientRead(Sender: TObject; Socket: TCustomWinSocket); begin if Socket.ReceiveText ="r" then edit1.text:="Conect complete"; end; на событие Дестрой формы: procedure TForm1.FormDestroy(Sender: TObject); begin http://www.delphisources.ru/forum/showthread.php?t=18929 ServerSocket1.active:=false; end; Порт выставил 3333 Потом сделал клиента на него кинул кнопку, на онклик кнопки клиента : procedure TForm1.Button1Click(Sender: TObject); begin clientsocket1.active:=true; clientsocket1.socket.sendtext("r"); clientsocket1.active:=false; end; socket error в host написал: 127.0.0.1 и порт выставил:3333 ну и запускаю ето все дело а оно мне: Windows socket error: (10049), on API "connect" чтож делать то? TButton (2003-10-16 04:45) [1] на БатонКлик client.Socket.Open; на ClientSocketConnect clientSocket.Socket.SendText("r"); clientSocket.Close; Digitman (2003-10-16 08:42) [2] Specifies an alias for the asynchronous socket error IP address of the server system. property Host: string; Description Host is a string containing the domain name and service of a particular system, such as http://www.wSite.Com For client sockets, set Host to the system with which the client socket should form a connection. When the socket opens a connection, it looks up the IP address for the server socket using the value of Host. Some servers change the system or IP address that is associated with a particular host name. Using a host name allows the client socket to find the abstract site represented by the host name, even when it has moved to a new IP address. If Host is set, it takes precedence over the Address property when looking up the address of the server. qqqqq0001 (2003-10-16 13:07) [3] procedure TForm1.Button1Click(Sender: TObject); begin clientsocket1.open; end; ну и при нажатии на кнопку снов
... #1 07.11.2011, 15:14 Deell : 02.09.2011 : 19 : 10 10049 socket error : if CheckBox1.Checked=True then begin ClientSocket1.Host:='comp1'; ClientSocket1.Open; ClientSocket1.Close; end; if CheckBox2.Checked=True then begin ClientSocket1.Host:='comp2'; ClientSocket1.Open; ClientSocket1.Close; end; procedure TForm1.ClientSocket1Connect(Sender: TObject; Socket: TCustomWinSocket); begin ClientSocket1.Socket.SendText('s'); ClientSocket1.Close; end; asynchronous socket error 10049, showmessage, . ? Deell Deell Deell #2 07.11.2011, 20:42 Delphist : 10.12.2010 : : 67 : 6002 ClientSocket1.Host:='comp1'; ? Host ( 192.127.01.01), comp1??? ? ClientSocket1.Port:=2011? ? Delphist Delphist Email Delphist Delphist #3 08.11.2011, 08:20 Deell : 02.09.2011 : 19 : 10 comp . , , IF Showmessage , Deell Deell Deell #4 08.11.2011, 08:56 NumLock Let Me Show You : 30.04.2010 : : 5,144 Delphi: 7, 2010, XE5 : 59585 : Deell ? , - : , !!! - , ? - send close (, SO_LINGER)? -if' begin-end! - == true? -... ) __________________ . __________________ NumLock NumLock