When I call TWSocket's Send method, I'm getting error 10057, "Send Socket is not connected"
Even after adding a call to WSocket_AsClient.Connect, I still get the same thing. However, when I add a second call to Connect() just before the call to Send(), I get "Socket already in use" Here is my code: { User sends a msg } InitializeWSocketProperties; WSocket_AsClient.Connect; SendTheCurrentRecord; procedure TForm10.InitializeWSocketProperties; begin WSocket_AsClient.Addr := '10.172.2.93'; WSocket_AsClient.Port := 'telnet'; end; procedure TForm10.SendTheCurrentRecord; begin if cmbxMsgType.Items[cmbxMsgType.ItemIndex] = 'ACTIVATE_BOF_SORT' then SendActiv8BOFSortRecord . . . procedure TForm10.SendActiv8BOFSortRecord; var X: PActivateBOFSort; Ptr: PByte; iSent, iSize, iErrorCode: Integer; begin iSize := SizeOf(TActivateBOFSort); X := AllocMem(iSize); X^.OpCode := ACTIVATE_BOF_SORT; X^.Carrier := StrToIntDef(edt1.Text, 0); StrLCopy(X^.BOFSortLabel, PChar(edt2.Text), BOF_SORT_LABEL_LENGTH); X^.WorkstationOffset := StrToIntDef(edt3.Text, 0); X^.RecordTerminator := '~'; Ptr := PByte(X); WSocket_AsClient.Connect; //<--It says here "Socket already in use" while iSize > 0 do begin iSent := WSocket_AsClient.Send(Ptr, iSize); //<-- It says here "Send socket is not connected" if iSent > 0 then begin Inc(Ptr, iSent); Dec(iSize, iSent); Continue; end; if iSent = 0 then begin ClientSocket.Close; raise Exception.Create('Connection closed gracefully'); end; iErrorCode := WSAGetLastError; if iErrorCode <> WSAEWOULDBLOCK then raise Exception.CreateFmt('Socket Error: %d', [iErrorCode]); end; Clay Shannon
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If the reader of this message is not the intended recipient, you are hereby notified that your access is unauthorized, and any review, dissemination, distribution or copying of this message including any attachments is strictly prohibited. If you are not the intended recipient, please contact the sender and delete the material from any computer.
-- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be