Delphi and Kylix

Moderators: pritaeas
Number of threads: 7244
Number of posts: 19051

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
??????? Posted by bogdanul2003 on 17 Feb 2004 at 7:37 AM
How can I copy a file from a IdTCPClient to a IdTCPServer ?
Report
Re: ??????? Posted by softman on 17 Feb 2004 at 11:30 AM
: How can I copy a file from a IdTCPClient to a IdTCPServer ?
:
idTCPClient and idTCPSercer is an implementation of the operatig system sockets. Basically it is not for file transfer, so if I'm right, you have to write your own protocol, and file managament system. You can use idTCPServer, and client for connecting the two computers peer to peer on the network, under tcp/ip, and use this sockets to transfer data.

I hope it can help some
Softman
Report
Re: ??????? Posted by bogdanul2003 on 18 Feb 2004 at 5:11 AM
This message was edited by bogdanul2003 at 2004-2-18 6:7:22

This message was edited by bogdanul2003 at 2004-2-18 5:13:57

: : How can I copy a file from a IdTCPClient to a IdTCPServer ?
: :
: idTCPClient and idTCPSercer is an implementation of the operatig system sockets. Basically it is not for file transfer, so if I'm right, you have to write your own protocol, and file managament system. You can use idTCPServer, and client for connecting the two computers peer to peer on the network, under tcp/ip, and use this sockets to transfer data.
:
: I hope it can help some
: Softman
:

I have made a code that transmits the content of a file but i have a problem.I use textfile to read data from a file with readln(s) s:string.
But when i read an executable file it contains some caracters wich are not read.for exemple:


From this it can read only 4 @ it dosen't read .Can you tell me how to read ? from an exxecutabel file ?
And i have one more questen how can I find out the IP of the local computer on wich i'm running a IdTCPServer.
10X


Report
Re: ??????? Posted by netgert on 18 Feb 2004 at 6:49 AM
This message was edited by netgert at 2004-2-18 6:50:0

very descriptive title

when using readln you are readin the file in ascii mode but to read executables and others you need to read them in binary mode. you can do this by defining a variable of type file of Byte and use read or blockread to read the file. in case of blockread you can skip the file-of-byte process and define it as just plain file but then you have to use reset(f, 1).
note that you cant send it in ascii mode anymore. you have to send the binary data you read from file, using sendbuf or something like that
the same applies ti receiving data (readbuf) and writing data (rewrite(f, 1); blockwrite)

hope that i explained it clear enough


: This message was edited by bogdanul2003 at 2004-2-18 6:7:22

: This message was edited by bogdanul2003 at 2004-2-18 5:13:57

: : : How can I copy a file from a IdTCPClient to a IdTCPServer ?
: : :
: : idTCPClient and idTCPSercer is an implementation of the operatig system sockets. Basically it is not for file transfer, so if I'm right, you have to write your own protocol, and file managament system. You can use idTCPServer, and client for connecting the two computers peer to peer on the network, under tcp/ip, and use this sockets to transfer data.
: :
: : I hope it can help some
: : Softman
: :
:
: I have made a code that transmits the content of a file but i have a problem.I use textfile to read data from a file with readln(s) s:string.
: But when i read an executable file it contains some caracters wich are not read.for exemple:

: From this it can read only 4 @ it dosen't read .Can you tell me how to read ? from an exxecutabel file ?
: And i have one more questen how can I find out the IP of the local computer on wich i'm running a IdTCPServer.
: 10X
:
:
:


NetGert[/italic]




Report
Re: ??????? Posted by bogdanul2003 on 18 Feb 2004 at 8:39 AM
: This message was edited by netgert at 2004-2-18 6:50:0

: very descriptive title
:
: when using readln you are readin the file in ascii mode but to read executables and others you need to read them in binary mode. you can do this by defining a variable of type file of Byte and use read or blockread to read the file. in case of blockread you can skip the file-of-byte process and define it as just plain file but then you have to use reset(f, 1).
: note that you cant send it in ascii mode anymore. you have to send the binary data you read from file, using sendbuf or something like that
: the same applies ti receiving data (readbuf) and writing data (rewrite(f, 1); blockwrite)
:
: hope that i explained it clear enough
:
:
: : This message was edited by bogdanul2003 at 2004-2-18 6:7:22

: : This message was edited by bogdanul2003 at 2004-2-18 5:13:57

: : : : How can I copy a file from a IdTCPClient to a IdTCPServer ?
: : : :
: : : idTCPClient and idTCPSercer is an implementation of the operatig system sockets. Basically it is not for file transfer, so if I'm right, you have to write your own protocol, and file managament system. You can use idTCPServer, and client for connecting the two computers peer to peer on the network, under tcp/ip, and use this sockets to transfer data.
: : :
: : : I hope it can help some
: : : Softman
: : :
: :
: : I have made a code that transmits the content of a file but i have a problem.I use textfile to read data from a file with readln(s) s:string.
: : But when i read an executable file it contains some caracters wich are not read.for exemple:


: : From this it can read only 4 @ it dosen't read .Can you tell me how to read ? from an exxecutabel file ?
: : And i have one more questen how can I find out the IP of the local computer on wich i'm running a IdTCPServer.
: : 10X
: :
: :
: :
:

how do i use blockread ?:)
:
NetGert[/italic]

:
:
:
:

Report
Re: ??????? Posted by softman on 18 Feb 2004 at 8:59 AM
You can determine the IP address of the computer. by the following procedure, using API calles:


function TPhone.MyIP:String;
var
  WSAData: TWSAData;
  HostName: array[0..255] of Char;
  HostInfo: PHostEnt;
  InAddr: ^PInAddr;
begin
  if WSAStartup($0101, WSAData) = 0 then  //API CALL!
  try
    if gethostname(HostName, SizeOf(HostName)) = 0 then
    begin
      HostInfo := gethostbyname(HostName);
      SelfName:=HostName;
      if HostInfo <> nil then  //if Hostinfo points 
      begin
        InAddr := Pointer(HostInfo^.h_addr_list); //by the pointer
        if (InAddr <> nil) then   //The IP address under that
          while InAddr^ <> nil do //Good for detecting all of the IP's
          begin                   //even, if you have more network card in your computer
            Result :=(inet_ntoa(InAddr^^));
            Inc(InAddr);
          end;
      end;
    end;
  finally              //Then close the WinSock
    WSACleanup;        //IT IS IMPORTANT
  end;
end;


You can read the binary buffer like:

procedure TPhone.serverAccept(Sender: TObject;
  ClientSocket: TCustomIpClient);
  var
    GetBuf : Array[0..255] of char;
begin
ClientSocket.ReceiveBuf(GetBuf,255);
....
...
..

: : This message was edited by netgert at 2004-2-18 6:50:0

: : very descriptive title
: :
: : when using readln you are readin the file in ascii mode but to read executables and others you need to read them in binary mode. you can do this by defining a variable of type file of Byte and use read or blockread to read the file. in case of blockread you can skip the file-of-byte process and define it as just plain file but then you have to use reset(f, 1).
: : note that you cant send it in ascii mode anymore. you have to send the binary data you read from file, using sendbuf or something like that
: : the same applies ti receiving data (readbuf) and writing data (rewrite(f, 1); blockwrite)
: :
: : hope that i explained it clear enough
: :
: :
: : : This message was edited by bogdanul2003 at 2004-2-18 6:7:22

: : : This message was edited by bogdanul2003 at 2004-2-18 5:13:57

: : : : : How can I copy a file from a IdTCPClient to a IdTCPServer ?
: : : : :
: : : : idTCPClient and idTCPSercer is an implementation of the operatig system sockets. Basically it is not for file transfer, so if I'm right, you have to write your own protocol, and file managament system. You can use idTCPServer, and client for connecting the two computers peer to peer on the network, under tcp/ip, and use this sockets to transfer data.
: : : :
: : : : I hope it can help some
: : : : Softman
: : : :
: : :
: : : I have made a code that transmits the content of a file but i have a problem.I use textfile to read data from a file with readln(s) s:string.
: : : But when i read an executable file it contains some caracters wich are not read.for exemple:

: : : From this it can read only 4 @ it dosen't read .Can you tell me how to read from an exxecutabel file ?
: : : And i have one more questen how can I find out the IP of the local computer on wich i'm running a IdTCPServer.
: : : 10X
: : :
: : :
: : :
: :
:
: how do i use blockread ?:)
: :
NetGert[/italic]

: :
: :
: :
: :
:
:

Report
Re: ??????? Posted by bogdanul2003 on 19 Feb 2004 at 7:34 AM
This message was edited by bogdanul2003 at 2004-2-19 8:1:16

This message was edited by bogdanul2003 at 2004-2-19 7:37:43

: You can determine the IP address of the computer. by the following procedure, using API calles:
:
:
: 
: function TPhone.MyIP:String;
: var
:   WSAData: TWSAData;
:   HostName: array[0..255] of Char;
:   HostInfo: PHostEnt;
:   InAddr: ^PInAddr;
: begin
:   if WSAStartup($0101, WSAData) = 0 then  //API CALL!
:   try
:     if gethostname(HostName, SizeOf(HostName)) = 0 then
:     begin
:       HostInfo := gethostbyname(HostName);
:       SelfName:=HostName;
:       if HostInfo <> nil then  //if Hostinfo points 
:       begin
:         InAddr := Pointer(HostInfo^.h_addr_list); //by the pointer
:         if (InAddr <> nil) then   //The IP address under that
:           while InAddr^ <> nil do //Good for detecting all of the IP's
:           begin                   //even, if you have more network card in your computer
:             Result :=(inet_ntoa(InAddr^^));
:             Inc(InAddr);
:           end;
:       end;
:     end;
:   finally              //Then close the WinSock
:     WSACleanup;        //IT IS IMPORTANT
:   end;
: end;
: 
: 

: You can read the binary buffer like:
:
:
: procedure TPhone.serverAccept(Sender: TObject;
:   ClientSocket: TCustomIpClient);
:   var
:     GetBuf : Array[0..255] of char;
: begin
: ClientSocket.ReceiveBuf(GetBuf,255);
: ....
: ...
: ..
: 

: : : This message was edited by netgert at 2004-2-18 6:50:0

: : : very descriptive title
: : :
: : : when using readln you are readin the file in ascii mode but to read executables and others you need to read them in binary mode. you can do this by defining a variable of type file of Byte and use read or blockread to read the file. in case of blockread you can skip the file-of-byte process and define it as just plain file but then you have to use reset(f, 1).
: : : note that you cant send it in ascii mode anymore. you have to send the binary data you read from file, using sendbuf or something like that
: : : the same applies ti receiving data (readbuf) and writing data (rewrite(f, 1); blockwrite)
: : :
: : : hope that i explained it clear enough
: : :
: : :
: : : : This message was edited by bogdanul2003 at 2004-2-18 6:7:22

: : : : This message was edited by bogdanul2003 at 2004-2-18 5:13:57

: : : : : : How can I copy a file from a IdTCPClient to a IdTCPServer ?
: : : : : :
: : : : : idTCPClient and idTCPSercer is an implementation of the operatig system sockets. Basically it is not for file transfer, so if I'm right, you have to write your own protocol, and file managament system. You can use idTCPServer, and client for connecting the two computers peer to peer on the network, under tcp/ip, and use this sockets to transfer data.
: : : : :
: : : : : I hope it can help some
: : : : : Softman
: : : : :
: : : :
: : : : I have made a code that transmits the content of a file but i have a problem.I use textfile to read data from a file with readln(s) s:string.
: : : : But when i read an executable file it contains some caracters wich are not read.for exemple:


: : : : From this it can read only 4 @ it dosen't read .Can you tell me how to read from an exxecutabel file ?
: : : : And i have one more questen how can I find out the IP of the local computer on wich i'm running a IdTCPServer.
: : : : 10X
: : : :
: : : :
: : : :
: : :
: :
: : how do i use blockread ?:)
: : :
NetGert[/italic]

: : :
: : :
: : :
: : :
: :
: :
:
:

How can i change to a specified key or insert a string value in to a key name ?(registers)
bytheway 10x for helping me :)




Report
Re: ??????? Posted by zibadian on 19 Feb 2004 at 8:23 AM
: This message was edited by bogdanul2003 at 2004-2-19 8:1:16

: This message was edited by bogdanul2003 at 2004-2-19 7:37:43

: : You can determine the IP address of the computer. by the following procedure, using API calles:
: :
: :
: : 
: : function TPhone.MyIP:String;
: : var
: :   WSAData: TWSAData;
: :   HostName: array[0..255] of Char;
: :   HostInfo: PHostEnt;
: :   InAddr: ^PInAddr;
: : begin
: :   if WSAStartup($0101, WSAData) = 0 then  //API CALL!
: :   try
: :     if gethostname(HostName, SizeOf(HostName)) = 0 then
: :     begin
: :       HostInfo := gethostbyname(HostName);
: :       SelfName:=HostName;
: :       if HostInfo <> nil then  //if Hostinfo points 
: :       begin
: :         InAddr := Pointer(HostInfo^.h_addr_list); //by the pointer
: :         if (InAddr <> nil) then   //The IP address under that
: :           while InAddr^ <> nil do //Good for detecting all of the IP's
: :           begin                   //even, if you have more network card in your computer
: :             Result :=(inet_ntoa(InAddr^^));
: :             Inc(InAddr);
: :           end;
: :       end;
: :     end;
: :   finally              //Then close the WinSock
: :     WSACleanup;        //IT IS IMPORTANT
: :   end;
: : end;
: : 
: : 

: : You can read the binary buffer like:
: :
: :
: : procedure TPhone.serverAccept(Sender: TObject;
: :   ClientSocket: TCustomIpClient);
: :   var
: :     GetBuf : Array[0..255] of char;
: : begin
: : ClientSocket.ReceiveBuf(GetBuf,255);
: : ....
: : ...
: : ..
: : 

: : : : This message was edited by netgert at 2004-2-18 6:50:0

: : : : very descriptive title
: : : :
: : : : when using readln you are readin the file in ascii mode but to read executables and others you need to read them in binary mode. you can do this by defining a variable of type file of Byte and use read or blockread to read the file. in case of blockread you can skip the file-of-byte process and define it as just plain file but then you have to use reset(f, 1).
: : : : note that you cant send it in ascii mode anymore. you have to send the binary data you read from file, using sendbuf or something like that
: : : : the same applies ti receiving data (readbuf) and writing data (rewrite(f, 1); blockwrite)
: : : :
: : : : hope that i explained it clear enough
: : : :
: : : :
: : : : : This message was edited by bogdanul2003 at 2004-2-18 6:7:22

: : : : : This message was edited by bogdanul2003 at 2004-2-18 5:13:57

: : : : : : : How can I copy a file from a IdTCPClient to a IdTCPServer ?
: : : : : : :
: : : : : : idTCPClient and idTCPSercer is an implementation of the operatig system sockets. Basically it is not for file transfer, so if I'm right, you have to write your own protocol, and file managament system. You can use idTCPServer, and client for connecting the two computers peer to peer on the network, under tcp/ip, and use this sockets to transfer data.
: : : : : :
: : : : : : I hope it can help some
: : : : : : Softman
: : : : : :
: : : : :
: : : : : I have made a code that transmits the content of a file but i have a problem.I use textfile to read data from a file with readln(s) s:string.
: : : : : But when i read an executable file it contains some caracters wich are not read.for exemple:


: : : : : From this it can read only 4 @ it dosen't read .Can you tell me how to read from an exxecutabel file ?
: : : : : And i have one more questen how can I find out the IP of the local computer on wich i'm running a IdTCPServer.
: : : : : 10X
: : : : :
: : : : :
: : : : :
: : : :
: : :
: : : how do i use blockread ?:)
: : : :
NetGert[/italic]

: : : :
: : : :
: : : :
: : : :
: : :
: : :
: :
: :
:
: How can i change to a specified key or insert a string value in to a key name ?(registers)
: bytheway 10x for helping me :)
:
:
:
:
:
You can use the TRegistry object for that. Here is a short code (from memory, check with help files), which creates a new key in the current user rootkey.
  RegObj := TRegistry.Create;
  with RegObject do 
  begin
    RootKey := HKEY_CURRENT_USER;
    OpenKey('MyKey', true);
    WriteString('MyValue', 'Some string');
  end;
  RegObj.Free;

More info on the TRegistry object can be found in the help files.
Report
Re: ??????? Posted by bogdanul2003 on 19 Feb 2004 at 1:11 PM
This message was edited by bogdanul2003 at 2004-2-20 4:55:18

: : This message was edited by bogdanul2003 at 2004-2-19 8:1:16

: : This message was edited by bogdanul2003 at 2004-2-19 7:37:43

: : : You can determine the IP address of the computer. by the following procedure, using API calles:
: : :
: : :
: : : 
: : : function TPhone.MyIP:String;
: : : var
: : :   WSAData: TWSAData;
: : :   HostName: array[0..255] of Char;
: : :   HostInfo: PHostEnt;
: : :   InAddr: ^PInAddr;
: : : begin
: : :   if WSAStartup($0101, WSAData) = 0 then  //API CALL!
: : :   try
: : :     if gethostname(HostName, SizeOf(HostName)) = 0 then
: : :     begin
: : :       HostInfo := gethostbyname(HostName);
: : :       SelfName:=HostName;
: : :       if HostInfo <> nil then  //if Hostinfo points 
: : :       begin
: : :         InAddr := Pointer(HostInfo^.h_addr_list); //by the pointer
: : :         if (InAddr <> nil) then   //The IP address under that
: : :           while InAddr^ <> nil do //Good for detecting all of the IP's
: : :           begin                   //even, if you have more network card in your computer
: : :             Result :=(inet_ntoa(InAddr^^));
: : :             Inc(InAddr);
: : :           end;
: : :       end;
: : :     end;
: : :   finally              //Then close the WinSock
: : :     WSACleanup;        //IT IS IMPORTANT
: : :   end;
: : : end;
: : : 
: : : 

: : : You can read the binary buffer like:
: : :
: : :
: : : procedure TPhone.serverAccept(Sender: TObject;
: : :   ClientSocket: TCustomIpClient);
: : :   var
: : :     GetBuf : Array[0..255] of char;
: : : begin
: : : ClientSocket.ReceiveBuf(GetBuf,255);
: : : ....
: : : ...
: : : ..
: : : 

: : : : : This message was edited by netgert at 2004-2-18 6:50:0

: : : : : very descriptive title
: : : : :
: : : : : when using readln you are readin the file in ascii mode but to read executables and others you need to read them in binary mode. you can do this by defining a variable of type file of Byte and use read or blockread to read the file. in case of blockread you can skip the file-of-byte process and define it as just plain file but then you have to use reset(f, 1).
: : : : : note that you cant send it in ascii mode anymore. you have to send the binary data you read from file, using sendbuf or something like that
: : : : : the same applies ti receiving data (readbuf) and writing data (rewrite(f, 1); blockwrite)
: : : : :
: : : : : hope that i explained it clear enough
: : : : :
: : : : :
: : : : : : This message was edited by bogdanul2003 at 2004-2-18 6:7:22

: : : : : : This message was edited by bogdanul2003 at 2004-2-18 5:13:57

: : : : : : : : How can I copy a file from a IdTCPClient to a IdTCPServer ?
: : : : : : : :
: : : : : : : idTCPClient and idTCPSercer is an implementation of the operatig system sockets. Basically it is not for file transfer, so if I'm right, you have to write your own protocol, and file managament system. You can use idTCPServer, and client for connecting the two computers peer to peer on the network, under tcp/ip, and use this sockets to transfer data.
: : : : : : :
: : : : : : : I hope it can help some
: : : : : : : Softman
: : : : : : :
: : : : : :
: : : : : : I have made a code that transmits the content of a file but i have a problem.I use textfile to read data from a file with readln(s) s:string.
: : : : : : But when i read an executable file it contains some caracters wich are not read.for exemple:

: : : : : : From this it can read only 4 @ it dosen't read ?.Can you tell me how to read ? from an exxecutabel file ?
: : : : : : And i have one more questen how can I find out the IP of the local computer on wich i'm running a IdTCPServer.
: : : : : : 10X
: : : : : :
: : : : : :
: : : : : :
: : : : :
: : : :
: : : : how do i use blockread ?:)
: : : : :
NetGert[/italic]

: : : : :
: : : : :
: : : : :
: : : : :
: : : :
: : : :
: : :
: : :
: :
: : How can i change to a specified key or insert a string value in to a key name ?(registers)
: : bytheway 10x for helping me :)
: :
: :
: :
: :
: :
: You can use the TRegistry object for that. Here is a short code (from memory, check with help files), which creates a new key in the current user rootkey.
:
:   RegObj := TRegistry.Create;
:   with RegObject do 
:   begin
:     RootKey := HKEY_CURRENT_USER;
:     OpenKey('MyKey', true);
:     WriteString('MyValue', 'Some string');
:   end;
:   RegObj.Free;
: 

: More info on the TRegistry object can be found in the help files.
:


How can i acces a shared folder or partition on a network.I'm sharing my D: and i want to have acces to it truh a nettwork application.Can i make an application in delphi to do this ?Is it possibel ?
10x


Report
Re: ??????? Posted by bogdanul2003 on 21 Feb 2004 at 6:48 AM
: This message was edited by bogdanul2003 at 2004-2-20 4:55:18

: : : This message was edited by bogdanul2003 at 2004-2-19 8:1:16

: : : This message was edited by bogdanul2003 at 2004-2-19 7:37:43

: : : : You can determine the IP address of the computer. by the following procedure, using API calles:
: : : :
: : : :
: : : : 
: : : : function TPhone.MyIP:String;
: : : : var
: : : :   WSAData: TWSAData;
: : : :   HostName: array[0..255] of Char;
: : : :   HostInfo: PHostEnt;
: : : :   InAddr: ^PInAddr;
: : : : begin
: : : :   if WSAStartup($0101, WSAData) = 0 then  //API CALL!
: : : :   try
: : : :     if gethostname(HostName, SizeOf(HostName)) = 0 then
: : : :     begin
: : : :       HostInfo := gethostbyname(HostName);
: : : :       SelfName:=HostName;
: : : :       if HostInfo <> nil then  //if Hostinfo points 
: : : :       begin
: : : :         InAddr := Pointer(HostInfo^.h_addr_list); //by the pointer
: : : :         if (InAddr <> nil) then   //The IP address under that
: : : :           while InAddr^ <> nil do //Good for detecting all of the IP's
: : : :           begin                   //even, if you have more network card in your computer
: : : :             Result :=(inet_ntoa(InAddr^^));
: : : :             Inc(InAddr);
: : : :           end;
: : : :       end;
: : : :     end;
: : : :   finally              //Then close the WinSock
: : : :     WSACleanup;        //IT IS IMPORTANT
: : : :   end;
: : : : end;
: : : : 
: : : : 

: : : : You can read the binary buffer like:
: : : :
: : : :
: : : : procedure TPhone.serverAccept(Sender: TObject;
: : : :   ClientSocket: TCustomIpClient);
: : : :   var
: : : :     GetBuf : Array[0..255] of char;
: : : : begin
: : : : ClientSocket.ReceiveBuf(GetBuf,255);
: : : : ....
: : : : ...
: : : : ..
: : : : 

: : : : : : This message was edited by netgert at 2004-2-18 6:50:0

: : : : : : very descriptive title
: : : : : :
: : : : : : when using readln you are readin the file in ascii mode but to read executables and others you need to read them in binary mode. you can do this by defining a variable of type file of Byte and use read or blockread to read the file. in case of blockread you can skip the file-of-byte process and define it as just plain file but then you have to use reset(f, 1).
: : : : : : note that you cant send it in ascii mode anymore. you have to send the binary data you read from file, using sendbuf or something like that
: : : : : : the same applies ti receiving data (readbuf) and writing data (rewrite(f, 1); blockwrite)
: : : : : :
: : : : : : hope that i explained it clear enough
: : : : : :
: : : : : :
: : : : : : : This message was edited by bogdanul2003 at 2004-2-18 6:7:22

: : : : : : : This message was edited by bogdanul2003 at 2004-2-18 5:13:57

: : : : : : : : : How can I copy a file from a IdTCPClient to a IdTCPServer ?
: : : : : : : : :
: : : : : : : : idTCPClient and idTCPSercer is an implementation of the operatig system sockets. Basically it is not for file transfer, so if I'm right, you have to write your own protocol, and file managament system. You can use idTCPServer, and client for connecting the two computers peer to peer on the network, under tcp/ip, and use this sockets to transfer data.
: : : : : : : :
: : : : : : : : I hope it can help some
: : : : : : : : Softman
: : : : : : : :
: : : : : : :
: : : : : : : I have made a code that transmits the content of a file but i have a problem.I use textfile to read data from a file with readln(s) s:string.
: : : : : : : But when i read an executable file it contains some caracters wich are not read.for exemple:

: : : : : : : From this it can read only 4 @ it dosen't read .Can you tell me how to read from an exxecutabel file ?
: : : : : : : And i have one more questen how can I find out the IP of the local computer on wich i'm running a IdTCPServer.
: : : : : : : 10X
: : : : : : :
: : : : : : :
: : : : : : :
: : : : : :
: : : : :
: : : : : how do i use blockread ?:)
: : : : : :
NetGert[/italic]

: : : : : :
: : : : : :
: : : : : :
: : : : : :
: : : : :
: : : : :
: : : :
: : : :
: : :
: : : How can i change to a specified key or insert a string value in to a key name ?(registers)
: : : bytheway 10x for helping me :)
: : :
: : :
: : :
: : :
: : :
: : You can use the TRegistry object for that. Here is a short code (from memory, check with help files), which creates a new key in the current user rootkey.
: :
: :   RegObj := TRegistry.Create;
: :   with RegObject do 
: :   begin
: :     RootKey := HKEY_CURRENT_USER;
: :     OpenKey('MyKey', true);
: :     WriteString('MyValue', 'Some string');
: :   end;
: :   RegObj.Free;
: : 

: : More info on the TRegistry object can be found in the help files.
: :
:
:
: How can i acces a shared folder or partition on a network.I'm sharing my D: and i want to have acces to it truh a nettwork application.Can i make an application in delphi to do this ?Is it possibel ?
: 10x
: Can someone please tell me if it's possibel to acces a shared folder on a network computer if it's possibel how to do it.
10x
:
:

Report
Re: ??????? Posted by zibadian on 21 Feb 2004 at 7:18 AM
: : This message was edited by bogdanul2003 at 2004-2-20 4:55:18

: : : : This message was edited by bogdanul2003 at 2004-2-19 8:1:16

: : : : This message was edited by bogdanul2003 at 2004-2-19 7:37:43

: : : : : You can determine the IP address of the computer. by the following procedure, using API calles:
: : : : :
: : : : :
: : : : : 
: : : : : function TPhone.MyIP:String;
: : : : : var
: : : : :   WSAData: TWSAData;
: : : : :   HostName: array[0..255] of Char;
: : : : :   HostInfo: PHostEnt;
: : : : :   InAddr: ^PInAddr;
: : : : : begin
: : : : :   if WSAStartup($0101, WSAData) = 0 then  //API CALL!
: : : : :   try
: : : : :     if gethostname(HostName, SizeOf(HostName)) = 0 then
: : : : :     begin
: : : : :       HostInfo := gethostbyname(HostName);
: : : : :       SelfName:=HostName;
: : : : :       if HostInfo <> nil then  //if Hostinfo points 
: : : : :       begin
: : : : :         InAddr := Pointer(HostInfo^.h_addr_list); //by the pointer
: : : : :         if (InAddr <> nil) then   //The IP address under that
: : : : :           while InAddr^ <> nil do //Good for detecting all of the IP's
: : : : :           begin                   //even, if you have more network card in your computer
: : : : :             Result :=(inet_ntoa(InAddr^^));
: : : : :             Inc(InAddr);
: : : : :           end;
: : : : :       end;
: : : : :     end;
: : : : :   finally              //Then close the WinSock
: : : : :     WSACleanup;        //IT IS IMPORTANT
: : : : :   end;
: : : : : end;
: : : : : 
: : : : : 

: : : : : You can read the binary buffer like:
: : : : :
: : : : :
: : : : : procedure TPhone.serverAccept(Sender: TObject;
: : : : :   ClientSocket: TCustomIpClient);
: : : : :   var
: : : : :     GetBuf : Array[0..255] of char;
: : : : : begin
: : : : : ClientSocket.ReceiveBuf(GetBuf,255);
: : : : : ....
: : : : : ...
: : : : : ..
: : : : : 

: : : : : : : This message was edited by netgert at 2004-2-18 6:50:0

: : : : : : : very descriptive title
: : : : : : :
: : : : : : : when using readln you are readin the file in ascii mode but to read executables and others you need to read them in binary mode. you can do this by defining a variable of type file of Byte and use read or blockread to read the file. in case of blockread you can skip the file-of-byte process and define it as just plain file but then you have to use reset(f, 1).
: : : : : : : note that you cant send it in ascii mode anymore. you have to send the binary data you read from file, using sendbuf or something like that
: : : : : : : the same applies ti receiving data (readbuf) and writing data (rewrite(f, 1); blockwrite)
: : : : : : :
: : : : : : : hope that i explained it clear enough
: : : : : : :
: : : : : : :
: : : : : : : : This message was edited by bogdanul2003 at 2004-2-18 6:7:22

: : : : : : : : This message was edited by bogdanul2003 at 2004-2-18 5:13:57

: : : : : : : : : : How can I copy a file from a IdTCPClient to a IdTCPServer ?
: : : : : : : : : :
: : : : : : : : : idTCPClient and idTCPSercer is an implementation of the operatig system sockets. Basically it is not for file transfer, so if I'm right, you have to write your own protocol, and file managament system. You can use idTCPServer, and client for connecting the two computers peer to peer on the network, under tcp/ip, and use this sockets to transfer data.
: : : : : : : : :
: : : : : : : : : I hope it can help some
: : : : : : : : : Softman
: : : : : : : : :
: : : : : : : :
: : : : : : : : I have made a code that transmits the content of a file but i have a problem.I use textfile to read data from a file with readln(s) s:string.
: : : : : : : : But when i read an executable file it contains some caracters wich are not read.for exemple:

: : : : : : : : From this it can read only 4 @ it dosen't read .Can you tell me how to read ? from an exxecutabel file ?
: : : : : : : : And i have one more questen how can I find out the IP of the local computer on wich i'm running a IdTCPServer.
: : : : : : : : 10X
: : : : : : : :
: : : : : : : :
: : : : : : : :
: : : : : : :
: : : : : :
: : : : : : how do i use blockread ?:)
: : : : : : :
NetGert[/italic]

: : : : : : :
: : : : : : :
: : : : : : :
: : : : : : :
: : : : : :
: : : : : :
: : : : :
: : : : :
: : : :
: : : : How can i change to a specified key or insert a string value in to a key name ?(registers)
: : : : bytheway 10x for helping me :)
: : : :
: : : :
: : : :
: : : :
: : : :
: : : You can use the TRegistry object for that. Here is a short code (from memory, check with help files), which creates a new key in the current user rootkey.
: : :
: : :   RegObj := TRegistry.Create;
: : :   with RegObject do 
: : :   begin
: : :     RootKey := HKEY_CURRENT_USER;
: : :     OpenKey('MyKey', true);
: : :     WriteString('MyValue', 'Some string');
: : :   end;
: : :   RegObj.Free;
: : : 

: : : More info on the TRegistry object can be found in the help files.
: : :
: :
: :
: : How can i acces a shared folder or partition on a network.I'm sharing my D: and i want to have acces to it truh a nettwork application.Can i make an application in delphi to do this ?Is it possibel ?
: : 10x
: : Can someone please tell me if it's possibel to acces a shared folder on a network computer if it's possibel how to do it.
: 10x
: :
: :
:
:
You could try to access it like you would access a local drive, since most shared drives are "marshalled" by the OS as "local" drives.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.