Welcome![Sign In][Sign Up]
Location:
Search - delphi idtcpclient

Search list

[ICQ-IM-Chatxue_wen_Pchat

Description: 本人初学delphi的网络开发,对许多的东西还不是很通,但这个代码也是呕心(不是恶心:-) )之作!因为初学往往把握不准核心,有缺乏通俗的教材,故而曰:万事开头难! 这个程序的目的:希望能对刚开始学习网络开发得朋友一点提示!了解基本的网络开发流程!学习使用delphi的网络组件! 这个小程序实现了:客户端线服务器的连接,服务器接受后根据客户的要求转发信息,从而实现多个客户端的交流! 这个程序的不足:由于时间仓促仅实现了核心功能,对于像qq那样的注册和管理客户信息都没有完善,但是我认为这与信息的发送是同理的,在以后有时间我会再继续学习完善的! 我的期待:希望大家能给我的程序提点意见,无论是从想法上,还是程序的风格上……只要您说,就是对我的帮助,我会感激不尽的! 使用的组件:IdTCPClient,IdTCPServer -I Beginners network development, many of the right things is still valid, but the code is disgusting (not nausea :-)) of for! Because beginners often not allowed to grasp the core, a lack of common materials, the club said : Everything is hard in the beginning! The purpose of this procedure : The hope is to just start learning network development in a friend suggested 1:00! Basic understanding of the network development process! Delphi learning to use the network components! This small program : client server line connectivity, server customers after receiving the request forward, thereby number of client communication! The procedures are inadequate : only limited time to achieve a core functions, such as qq the registration and management of customer information is not perfect, but I thin
Platform: | Size: 585592 | Author: oliver | Hits:

[Delphi VCL带附件及Html显示的邮件发送类

Description:

unit UnitSendMail;

interface

uses
  Windows, SysUtils, Classes,StdCtrls, ExtCtrls, ComCtrls, Dialogs,
  IdMessage, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
  IdExplicitTLSClientServerBase,IdMessageClient, IdSMTPBase, IdSMTP, IdText,
  IDAttachmentFile;

function SendEMail(SenderName, SenderAddress: PChar;
    Receivename, ReceiveAddress: PChar; MailSubject, MailContent: PChar;
    JpgFileName: PChar; SendType: Integer; PicID: PChar; IsCustom: Boolean;Attachment:PChar): Boolean; stdcall;
function ConnectMailServer(Host, UserName, Password: PChar;
    Port: Integer): Boolean; stdcall;
procedure DisconnectMail; stdcall;

type
  TSendMailObj = class
  private
    FHost: String;
    FPort: Integer;
    FUserName: String;
    FPassword: String;
    ASmtp: TIdSMTP;
  public
    property Host: string read FHost write FHost;
    property Port: Integer read FPort write FPort;
    property UserName: String read FUserName write FUserName;
    property Password: String read FPassword write FPassword;
    constructor Create;
    function ConnectServer: Boolean;
    function SendEMail(SenderName, SenderAddress: PChar;
      Receivename, ReceiveAddress: PChar; MailSubject, MailContent: PChar;
      JpgFileName: PChar; SendType: Integer; PicID: PChar;
      IsCustom: Boolean;Attachment:PChar): Boolean;
  end;

var
  SendObj: TSendMailObj;

implementation

function SendEMail(SenderName, SenderAddress: PChar;
    Receivename, ReceiveAddress: PChar; MailSubject, MailContent: PChar;
    JpgFileName: PChar; SendType: Integer; PicID: PChar; IsCustom: Boolean;Attachment:PChar): Boolean; stdcall;
begin
  Result :=  SendObj.SendEMail(SenderName, SenderAddress, Receivename,
          ReceiveAddress, MailSubject, MailContent,
            JpgFileName, SendType, PicID, IsCustom,Attachment);
end;

function ConnectMailServer(Host, UserName, Password: PChar;
    Port: Integer): Boolean; stdcall;
begin
  try
    //if SendObj = nil then
    SendObj := TSendMailObj.Create;
{    if SendObj.ASmtp.Connected then
      SendObj.ASmtp.Disconnect;  }
    SendObj.Host := StrPas(Host);
    SendObj.Port := Port;
    SendObj.Username := StrPas(UserName);
    SendObj.Password := StrPas(Password);
    Result := SendObj.ConnectServer;
  except
    Result := False;
  end;
end;

procedure DisconnectMail; stdcall;
begin
  if SendObj <> nil then
  begin
    if SendObj.ASmtp <> nil then
      SendObj.ASmtp.Disconnect;
    SendObj := nil;
    SendObj.Free;
  end;
end;
{ TSendMailObj }

function TSendMailObj.ConnectServer: Boolean;
begin
  ASmtp.Host := FHost;
  ASmtp.Port := FPort;
  ASmtp.Username := FUserName;
  ASmtp.Password := FPassword;
  try
    ASmtp.Connect;
    Result := ASmtp.Connected;
  except
    Result := False;
  end;
end;

constructor TSendMailObj.Create;
begin
  ASmtp := TIdSMTP.Create(nil);

end;

function TSendMailObj.SendEMail(SenderName, SenderAddress, Receivename,
  ReceiveAddress, MailSubject, MailContent, JpgFileName: PChar;
  SendType: Integer; PicID: PChar; IsCustom: Boolean;Attachment:PChar): Boolean;
var
  IdBody, IdHtml: TIdText;
  Att: TIdAttachmentFile;
  AMessage: TIdMessage;
  ASmtp_1: TIdSMTP;
begin
  ASmtp_1 := TIdSMTP.Create(nil);
  ASmtp_1.Host := FHost;
  ASmtp_1.Port := FPort;
  ASmtp_1.Username := FUserName;
  ASmtp_1.Password := FPassword;
  //ASmtp_1.AuthType := atDefault;
  ASmtp_1.Connect; // }
  if not ASmtp.Connected then
    ASmtp.Connect;
  AMessage := TIdMessage.Create(nil);
  with AMessage do
  begin
    NoDecode := False;
    NoEncode := False;
    ContentType := 'multipart/mixed';
    Encoding := meMIME;
    MsgId := 'PrettyPic';
    if FileExists(StrPas(JpgFileName)) then
      References := ChangeFileExt(ExtractFileName(StrPas(JpgFileName)), '')
    else
      References := '';
    Recipients.Clear;
    with Recipients.Add do
    begin
      Name := StrPas(Receivename);
      Address := StrPas(ReceiveAddress);
    end;
    Subject := StrPas(MailSubject);
    Sender.Name := StrPas(SenderName);
    Sender.Address := StrPas(SenderAddress);
    From.Name := Sender.Name;
    From.Address := Sender.Address;
    if SendType = 0 then
    begin
      IdBody := TIdText.Create(MessageParts);
      IdBody.ContentType := 'text/plain';
      IdBody.Body.Add(StrPas(MailContent));
      IdBody.Body.Add('');
    end
    else
    begin
      IdHtml := TIdText.Create(MessageParts);
      IdHtml.ContentType := 'text/html;charset=gb2312';
      IdHtml.ContentTransfer := '7bit';
      IdHtml.Body.Add(' <html>');
      IdHtml.Body.Add('  <head>');
      IdHtml.Body.Add('      <title>' + StrPas(MailSubject) + ' </title>');
      IdHtml.Body.Add('  </head>');
      IdHtml.Body.Add('  <body title="' + References + '">');
      IdHtml.Body.Add('    ' + StrPas(MailContent) + ' <br>');
      if (not IsCustom) and FileExists(StrPas(JpgFileName)) then
        IdHtml.Body.Add('      <img src="cid:' + StrPas(PicID) + '" alt="' + ExtractFileName(StrPas(JpgFileName)) +
                            '" name="' + ExtractFileName(StrPas(JpgFileName)) + '" title="">');
      IdHtml.Body.Add('  </body>');
      IdHtml.Body.Add(' </html>');
    end;
    if FileExists(StrPas(JpgFileName)) then
    begin
      Att := TIdAttachmentFile.Create(MessageParts, StrPas(JpgFileName));
      Att.ExtraHeaders.Values['Content-ID'] := StrPas(PicID);
      Att.ContentType := 'image/jpg';
    end;  
    if FileExists(StrPas(Attachment)) then
    begin
      Att := TIdAttachmentFile.Create(MessageParts, StrPas(Attachment));
    end;
  end;
  try
    ASmtp_1.Send(AMessage);
    if Att <> nil then
      Att.Free;
    if IdBody <> nil then
      IdBody.Free;
    if IdHtml <> nil then
      IdHtml.Free;
    if AMessage <> nil then
      AMessage.Free;
    ASmtp_1.Disconnect;

    ASmtp_1.Free; //}
    ASmtp.Disconnect;
    Result := True;
  except on e: Exception do
  begin
    Result := False;
  end;
  end;

end;

end.


Platform: | Size: 1685 | Author: kennyxue | Hits:

[ICQ-IM-Chatxue_wen_Pchat

Description: 本人初学delphi的网络开发,对许多的东西还不是很通,但这个代码也是呕心(不是恶心:-) )之作!因为初学往往把握不准核心,有缺乏通俗的教材,故而曰:万事开头难! 这个程序的目的:希望能对刚开始学习网络开发得朋友一点提示!了解基本的网络开发流程!学习使用delphi的网络组件! 这个小程序实现了:客户端线服务器的连接,服务器接受后根据客户的要求转发信息,从而实现多个客户端的交流! 这个程序的不足:由于时间仓促仅实现了核心功能,对于像qq那样的注册和管理客户信息都没有完善,但是我认为这与信息的发送是同理的,在以后有时间我会再继续学习完善的! 我的期待:希望大家能给我的程序提点意见,无论是从想法上,还是程序的风格上……只要您说,就是对我的帮助,我会感激不尽的! 使用的组件:IdTCPClient,IdTCPServer -I Beginners network development, many of the right things is still valid, but the code is disgusting (not nausea :-)) of for! Because beginners often not allowed to grasp the core, a lack of common materials, the club said : Everything is hard in the beginning! The purpose of this procedure : The hope is to just start learning network development in a friend suggested 1:00! Basic understanding of the network development process! Delphi learning to use the network components! This small program : client server line connectivity, server customers after receiving the request forward, thereby number of client communication! The procedures are inadequate : only limited time to achieve a core functions, such as qq the registration and management of customer information is not perfect, but I thin
Platform: | Size: 585728 | Author: | Hits:

[ICQ-IM-ChatNETchar1.1011

Description: delphi7.0下idtcpclient和idtcpserver制作的聊天室软件,对学习socket很有帮助-delphi7.0 under idtcpclient and produced idtcpserver chat room software, learning socket helpful
Platform: | Size: 345088 | Author: | Hits:

[Remote ControlEasyIndyDemo

Description:
Platform: | Size: 399360 | Author: axiu | Hits:

[OtherUnit1x32

Description: 一个游戏防外挂的登陆器源码。!自己搞的。很简单的。可能没什么用。-Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,winsock, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, IdIPWatch
Platform: | Size: 1024 | Author: name | Hits:

[Delphi VCLIdTCPServerdTCPClient

Description: delphi 用IdTCPServer和IdTCPClient传输文件,可以学习一下-delphi IdTCPClient with IdTCPServer and transfer files, you can learn about
Platform: | Size: 2048 | Author: 金秀 | Hits:

[Delphi VCLproject1

Description: delphi中使用IdTcpClient和IdTcpServer相互发送数据-delphi used to send data between IdTcpClient and IdTcpServer
Platform: | Size: 6144 | Author: w_pal | Hits:

[Internet-NetworkINdy10TCP

Description: 用delphi做的TCP的测试程序,主要介绍idTcpclient和idTcpServer的使用。此包两个程序,一个是tcp客户端向服务端发送普通的字符串。服务端对客户端发来的字符串进行显示,并返回信息给客户端。另一个程序介绍TCP客户端如何发送由多个记录组成的数据包到服务端。服务端如何校验消息头和提取消息内容,并返回应答消息包给客户端。代码中每句都有解释,并且有一篇本人自己写的关于本程序的思路和代码意思。目的是希望大家能够互相学习。 程序是使用delphixe3写的,indy版本是indy10.5.9-Delphi do with TCP test procedures, introduces idTcpclient and idTcpServer use. This package two programs, one is tcp client sends to the service of ordinary strings. Server sent to the client to display a string and returns the information to the client. Another procedure describes how to send TCP client multiple records of data packets to the server. How to check the server message header and extract the message content, and returns a response packet to the client. Code each sentence are explained, and there is a I wrote about the idea of ​ ​ this program and code meant. In the hope that we can learn from each other. Procedure is to use delphixe3 written, indy version is indy10.5.9
Platform: | Size: 513024 | Author: jonahking | Hits:

[Delphi VCLDelphi_424638

Description: Delphi:Delphi环境下基于idtcpserver断开与连接客户端,当客户端主动与服务端断开时,idtcpserver事件Disconnect能够接到消息,当客户端主动与服务端连接时,idtcpserver事件Connect能够接到消息。但是存在问题:当服务端断开客户端连接数,IdTCPClient事件Disconnected接不到到消息,只有客户端主动与服务端断开时IdTCPClient事件Disconnected才接到消息,烦请高人们支招。   实例中还涉及到idtcpserver最大连接数在程序中如何控制的解决方法。 -Delphi: Delphi environment based idtcpserver disconnect the client when the client is disconnected from the server-side initiative, idtcpserver event Disconnect able to receive the message, when the client and server to connect initiative, idtcpserver Connect event messages can be received . But there is a problem: When the server is disconnected client connections, IdTCPClient event Disconnected not receive the message, only the client and server is disconnected when the initiative IdTCPClient event Disconnected before receiving the news, I beg you high people Weapon. Example also involves solutions idtcpserver maximum number of connections in the program how to control.
Platform: | Size: 14336 | Author: 3KC5NC1 | Hits:

[TCP/IP stackidTcplink

Description: delphi用IdTCPServer和IdTCPClient传输文件-idTcp transfer files
Platform: | Size: 2048 | Author: 阿森 | Hits:

[TCP/IP stackTCPSendFile

Description: Delphi中使用Indy10控件,通过SOCKET收发文件的小程序-Delphi make program,include Client and server,by idTCPServer\idTcpClient
Platform: | Size: 492544 | Author: liyong | Hits:

[Delphi VCLIdTcp

Description: Delphi 基于IdTcpServer和IdTcpClient通讯实例源码(Delphi based on IdTcpServer and IdTcpClient communication example source code)
Platform: | Size: 22528 | Author: 胡施 | Hits:

CodeBus www.codebus.net