Board index » delphi » Internet, Sockets and other shit ...

Internet, Sockets and other shit ...

Sorry for that thumb topic,

HI
I'm not really amused about the Sockets in Delphi, cause everytime, I
get problems with my Client & Server Appz, it's not so that I could
not write one, there's no Problem, but I get everytime the same
failure, I don't know why (especially cause I build Programs with same
code and they WORK) ... oh I stop bugging you, and send the code,

FailureMessage is: "...raised exception class ESocketError with
message 'Windows socket error: (10057), on API 'send''. Process
stopped ..."

SS= ServerSocket // I'm sorry for this name, but I don't like to write
much like ServerSocket1...
CS= ClientSocket

Any help is welcome...

// ------------------- CLIENT --------------------

procedure TForm1.Button1Click(Sender: TObject);
begin
   WITH CS DO
     BEGIN
     Host := Edit1.Text;
     Port := StrToInt(Edit2.Text);
     active := true;
     END
end;

// for example:
procedure TForm1.Button3Click(Sender: TObject);
begin
CS.Socket.sendtext('GD');
end;

// -------------- SERVER -------
// Server should automatically send a response
// Sorry, there are German Comments

 procedure TForm1.SSClientRead(Sender: TObject;
  Socket: TCustomWinSocket);
var Input: String;
    i: Integer;
    Output: String;
begin
Input := socket.ReceiveText;

Memo2.Lines.Add(Input);

// Wenn wir einen neuen Eintrag bekommen dann hinzufgen
IF Length(Input) = 61 THEN
   BEGIN
   AddToListView(Input);
   Memo1.Lines.add(Input);
   END;

IF (Input = 'GD') Then      // GD stands for 'Get Data'
   Begin
   // Abarteiten der Eintr?ge
   For i:=1 to Memo1.Lines.count do
     begin
     Output := Memo1.Lines[i];

     // Keine Kommentare oder ?hnliches senden
     // sondern nur den Datensatz
     IF StrLen(PChar(Output)) = 61 THEN SS.Socket.Sendtext(Output);
     end;
   end;
end;

---------------------------------------------------

 

Re:Internet, Sockets and other shit ...


Sorry,
I found my fault (it's the same fault like last time, but is it a
fault in Delphi's Architecture too, it's not the only fault in it or
in Borlandfs function of Delphi [p.ex. try some things with the
"copy"-Function, it's quite buggy, I wrote one myself])
So I'm sorry for disturbing the group with this little fault by
myself! I should work with my own Components again, they're not so
easy too use, but more stable and with less faults...
Quote
On Sun, 25 Feb 2001 11:46:42 GMT, Bl...@Jack.de (Black Jack) wrote:
>Sorry for that thumb topic,

>HI
>I'm not really amused about the Sockets in Delphi, cause everytime, I
>get problems with my Client & Server Appz, it's not so that I could
>not write one, there's no Problem, but I get everytime the same
>failure, I don't know why (especially cause I build Programs with same
>code and they WORK) ... oh I stop bugging you, and send the code,

>FailureMessage is: "...raised exception class ESocketError with
>message 'Windows socket error: (10057), on API 'send''. Process
>stopped ..."

>SS= ServerSocket // I'm sorry for this name, but I don't like to write
>much like ServerSocket1...
>CS= ClientSocket

>Any help is welcome...

>// ------------------- CLIENT --------------------

>procedure TForm1.Button1Click(Sender: TObject);
>begin
>   WITH CS DO
>     BEGIN
>     Host := Edit1.Text;
>     Port := StrToInt(Edit2.Text);
>     active := true;
>     END
>end;

>// for example:
>procedure TForm1.Button3Click(Sender: TObject);
>begin
>CS.Socket.sendtext('GD');
>end;

>// -------------- SERVER -------
>// Server should automatically send a response
>// Sorry, there are German Comments

> procedure TForm1.SSClientRead(Sender: TObject;
>  Socket: TCustomWinSocket);
>var Input: String;
>    i: Integer;
>    Output: String;
>begin
>Input := socket.ReceiveText;

>Memo2.Lines.Add(Input);

>// Wenn wir einen neuen Eintrag bekommen dann hinzufgen
>IF Length(Input) = 61 THEN
>   BEGIN
>   AddToListView(Input);
>   Memo1.Lines.add(Input);
>   END;

>IF (Input = 'GD') Then      // GD stands for 'Get Data'
>   Begin
>   // Abarteiten der Eintr?ge
>   For i:=1 to Memo1.Lines.count do
>     begin
>     Output := Memo1.Lines[i];

>     // Keine Kommentare oder ?hnliches senden
>     // sondern nur den Datensatz
>     IF StrLen(PChar(Output)) = 61 THEN SS.Socket.Sendtext(Output);
>     end;
>   end;
>end;

>---------------------------------------------------

Re:Internet, Sockets and other shit ...


while winsocket=succ do
 goto http://www.nevrona.com/Indy/

Black Jack <Bl...@Jack.de> schreef in berichtnieuws
3a98ee23.1719...@news.btx.dtag.de...

Quote
> Sorry for that thumb topic,

> HI
> I'm not really amused about the Sockets in Delphi, cause everytime, I
> get problems with my Client & Server Appz, it's not so that I could
> not write one, there's no Problem, but I get everytime the same
> failure, I don't know why (especially cause I build Programs with same
> code and they WORK) ... oh I stop bugging you, and send the code,

> FailureMessage is: "...raised exception class ESocketError with
> message 'Windows socket error: (10057), on API 'send''. Process
> stopped ..."

> SS= ServerSocket // I'm sorry for this name, but I don't like to write
> much like ServerSocket1...
> CS= ClientSocket

> Any help is welcome...

> // ------------------- CLIENT --------------------

> procedure TForm1.Button1Click(Sender: TObject);
> begin
>    WITH CS DO
>      BEGIN
>      Host := Edit1.Text;
>      Port := StrToInt(Edit2.Text);
>      active := true;
>      END
> end;

> // for example:
> procedure TForm1.Button3Click(Sender: TObject);
> begin
> CS.Socket.sendtext('GD');
> end;

> // -------------- SERVER -------
> // Server should automatically send a response
> // Sorry, there are German Comments

>  procedure TForm1.SSClientRead(Sender: TObject;
>   Socket: TCustomWinSocket);
> var Input: String;
>     i: Integer;
>     Output: String;
> begin
> Input := socket.ReceiveText;

> Memo2.Lines.Add(Input);

> // Wenn wir einen neuen Eintrag bekommen dann hinzufgen
> IF Length(Input) = 61 THEN
>    BEGIN
>    AddToListView(Input);
>    Memo1.Lines.add(Input);
>    END;

> IF (Input = 'GD') Then      // GD stands for 'Get Data'
>    Begin
>    // Abarteiten der Eintr?ge
>    For i:=1 to Memo1.Lines.count do
>      begin
>      Output := Memo1.Lines[i];

>      // Keine Kommentare oder ?hnliches senden
>      // sondern nur den Datensatz
>      IF StrLen(PChar(Output)) = 61 THEN SS.Socket.Sendtext(Output);
>      end;
>    end;
> end;

> ---------------------------------------------------

Re:Internet, Sockets and other shit ...


Dont have time to check the code (College in 10 mins) but sounds like the
socket aint connected when you try to use it.

Dan

Quote
Black Jack <Bl...@Jack.de> wrote in message

news:3a98ee23.1719745@news.btx.dtag.de...
Quote
> Sorry for that thumb topic,

> HI
> I'm not really amused about the Sockets in Delphi, cause everytime, I
> get problems with my Client & Server Appz, it's not so that I could
> not write one, there's no Problem, but I get everytime the same
> failure, I don't know why (especially cause I build Programs with same
> code and they WORK) ... oh I stop bugging you, and send the code,

> FailureMessage is: "...raised exception class ESocketError with
> message 'Windows socket error: (10057), on API 'send''. Process
> stopped ..."

> SS= ServerSocket // I'm sorry for this name, but I don't like to write
> much like ServerSocket1...
> CS= ClientSocket

> Any help is welcome...

> // ------------------- CLIENT --------------------

> procedure TForm1.Button1Click(Sender: TObject);
> begin
>    WITH CS DO
>      BEGIN
>      Host := Edit1.Text;
>      Port := StrToInt(Edit2.Text);
>      active := true;
>      END
> end;

> // for example:
> procedure TForm1.Button3Click(Sender: TObject);
> begin
> CS.Socket.sendtext('GD');
> end;

> // -------------- SERVER -------
> // Server should automatically send a response
> // Sorry, there are German Comments

>  procedure TForm1.SSClientRead(Sender: TObject;
>   Socket: TCustomWinSocket);
> var Input: String;
>     i: Integer;
>     Output: String;
> begin
> Input := socket.ReceiveText;

> Memo2.Lines.Add(Input);

> // Wenn wir einen neuen Eintrag bekommen dann hinzufgen
> IF Length(Input) = 61 THEN
>    BEGIN
>    AddToListView(Input);
>    Memo1.Lines.add(Input);
>    END;

> IF (Input = 'GD') Then      // GD stands for 'Get Data'
>    Begin
>    // Abarteiten der Eintr?ge
>    For i:=1 to Memo1.Lines.count do
>      begin
>      Output := Memo1.Lines[i];

>      // Keine Kommentare oder ?hnliches senden
>      // sondern nur den Datensatz
>      IF StrLen(PChar(Output)) = 61 THEN SS.Socket.Sendtext(Output);
>      end;
>    end;
> end;

> ---------------------------------------------------

Other Threads