Тема: access violation
Показать сообщение отдельно
  #1  
Старый 04.05.2014, 14:37
Noooob Noooob вне форума
Прохожий
 
Регистрация: 24.12.2013
Сообщения: 38
Версия Delphi: Delphi 7
Репутация: 10
По умолчанию access violation

Здравствуйте, после подключения ClientSocket к ServerSocket программа выдает ошибку http://jtorrent.ru/view.php?img=2b80...062918b73efbfc

вот код
Код:
procedure TForm1.ServerSocket1ClientConnect(Sender: TObject;
  Socket: TCustomWinSocket);
var
    Msg:String;
    Cmd:string[3];
    Text:string;
    NewClient:PPacket;
    ItemList:TStringList;
    i:Integer;
begin
  msg:=Socket.ReceiveText;
 Cmd := Copy(msg,1,3);
 if (Cmd = '101') then
 begin
    Text := Copy(msg,4,maxint);
    New(NewClient);
    NewClient^.Nick := Text;
    Socket.Data := NewClient;
    ListBox1.Items.Add(Text);
    ItemList:=TStringList.Create;
   Ini.ReadSection('RegServers',ItemList);
   for i:=0 to ItemList.Count-1 do
   begin
    if not (ItemList.Strings[i]= Text) then
      Ini.WriteString('RegServers',Text,'');
   end;
   ItemList.Free;
   Ini.Free;
 end;
 if (Cmd = '102') then
 begin
    Text := Copy(msg,4,maxint);
    New(NewClient);
    NewClient^.Nick := Text;
    Socket.Data := NewClient;
    ListBox2.Items.Add(Text);
 end;
end;
Ответить с цитированием