: 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.
[b][red]This message was edited by bogdanul2003 at 2004-2-18 6:7:22[/red][/b][hr] [b][red]This message was edited by bogdanul2003 at 2004-2-18 5:13:57[/red][/b][hr] : : 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
[b][red]This message was edited by netgert at 2004-2-18 6:50:0[/red][/b][hr] 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 [b]file of Byte[/b] 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 [b]file[/b] but then you have to use [b]reset(f, 1)[/b]. 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
: [b][red]This message was edited by bogdanul2003 at 2004-2-18 6:7:22[/red][/b][hr] : [b][red]This message was edited by bogdanul2003 at 2004-2-18 5:13:57[/red][/b][hr] : : : 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 : : :
: [b][red]This message was edited by netgert at 2004-2-18 6:50:0[/red][/b][hr] : 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 [b]file of Byte[/b] 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 [b]file[/b] but then you have to use [b]reset(f, 1)[/b]. : 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 : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 6:7:22[/red][/b][hr] : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 5:13:57[/red][/b][hr] : : : : 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 ?:) : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr] : : : :
You can determine the IP address of the computer. by the following procedure, using API calles:
[code]
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;
[/code] You can read the binary buffer like:
[code] procedure TPhone.serverAccept(Sender: TObject; ClientSocket: TCustomIpClient); var GetBuf : Array[0..255] of char; begin ClientSocket.ReceiveBuf(GetBuf,255); .... ... .. [/code] : : [b][red]This message was edited by netgert at 2004-2-18 6:50:0[/red][/b][hr] : : 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 [b]file of Byte[/b] 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 [b]file[/b] but then you have to use [b]reset(f, 1)[/b]. : : 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 : : : : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 6:7:22[/red][/b][hr] : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 5:13:57[/red][/b][hr] : : : : : 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 ?:) : : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr] : : : : : : : : : :
[b][red]This message was edited by bogdanul2003 at 2004-2-19 8:1:16[/red][/b][hr] [b][red]This message was edited by bogdanul2003 at 2004-2-19 7:37:43[/red][/b][hr] : You can determine the IP address of the computer. by the following procedure, using API calles: : : [code] : : 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; : : [/code] : You can read the binary buffer like: : : [code] : procedure TPhone.serverAccept(Sender: TObject; : ClientSocket: TCustomIpClient); : var : GetBuf : Array[0..255] of char; : begin : ClientSocket.ReceiveBuf(GetBuf,255); : .... : ... : .. : [/code] : : : [b][red]This message was edited by netgert at 2004-2-18 6:50:0[/red][/b][hr] : : : 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 [b]file of Byte[/b] 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 [b]file[/b] but then you have to use [b]reset(f, 1)[/b]. : : : 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 : : : : : : : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 6:7:22[/red][/b][hr] : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 5:13:57[/red][/b][hr] : : : : : : 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 ?:) : : : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr] : : : : : : : : : : : : : : : : : :
How can i change to a specified key or insert a string value in to a key name ?(registers) bytheway 10x for helping me
: [b][red]This message was edited by bogdanul2003 at 2004-2-19 8:1:16[/red][/b][hr] : [b][red]This message was edited by bogdanul2003 at 2004-2-19 7:37:43[/red][/b][hr] : : You can determine the IP address of the computer. by the following procedure, using API calles: : : : : [code] : : : : 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; : : : : [/code] : : You can read the binary buffer like: : : : : [code] : : procedure TPhone.serverAccept(Sender: TObject; : : ClientSocket: TCustomIpClient); : : var : : GetBuf : Array[0..255] of char; : : begin : : ClientSocket.ReceiveBuf(GetBuf,255); : : .... : : ... : : .. : : [/code] : : : : [b][red]This message was edited by netgert at 2004-2-18 6:50:0[/red][/b][hr] : : : : 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 [b]file of Byte[/b] 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 [b]file[/b] but then you have to use [b]reset(f, 1)[/b]. : : : : 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 : : : : : : : : : : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 6:7:22[/red][/b][hr] : : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 5:13:57[/red][/b][hr] : : : : : : : 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 ?:) : : : : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr] : : : : : : : : : : : : : : : : : : : : : : : : : : : : 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. [code] RegObj := TRegistry.Create; with RegObject do begin RootKey := HKEY_CURRENT_USER; OpenKey('MyKey', true); WriteString('MyValue', 'Some string'); end; RegObj.Free; [/code] More info on the TRegistry object can be found in the help files.
[b][red]This message was edited by bogdanul2003 at 2004-2-20 4:55:18[/red][/b][hr] : : [b][red]This message was edited by bogdanul2003 at 2004-2-19 8:1:16[/red][/b][hr] : : [b][red]This message was edited by bogdanul2003 at 2004-2-19 7:37:43[/red][/b][hr] : : : You can determine the IP address of the computer. by the following procedure, using API calles: : : : : : : [code] : : : : : : 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; : : : : : : [/code] : : : You can read the binary buffer like: : : : : : : [code] : : : procedure TPhone.serverAccept(Sender: TObject; : : : ClientSocket: TCustomIpClient); : : : var : : : GetBuf : Array[0..255] of char; : : : begin : : : ClientSocket.ReceiveBuf(GetBuf,255); : : : .... : : : ... : : : .. : : : [/code] : : : : : [b][red]This message was edited by netgert at 2004-2-18 6:50:0[/red][/b][hr] : : : : : 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 [b]file of Byte[/b] 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 [b]file[/b] but then you have to use [b]reset(f, 1)[/b]. : : : : : 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 : : : : : : : : : : : : : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 6:7:22[/red][/b][hr] : : : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 5:13:57[/red][/b][hr] : : : : : : : : 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 ?:) : : : : : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr] : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 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. : [code] : RegObj := TRegistry.Create; : with RegObject do : begin : RootKey := HKEY_CURRENT_USER; : OpenKey('MyKey', true); : WriteString('MyValue', 'Some string'); : end; : RegObj.Free; : [/code] : 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 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
: [b][red]This message was edited by bogdanul2003 at 2004-2-20 4:55:18[/red][/b][hr] : : : [b][red]This message was edited by bogdanul2003 at 2004-2-19 8:1:16[/red][/b][hr] : : : [b][red]This message was edited by bogdanul2003 at 2004-2-19 7:37:43[/red][/b][hr] : : : : You can determine the IP address of the computer. by the following procedure, using API calles: : : : : : : : : [code] : : : : : : : : 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; : : : : : : : : [/code] : : : : You can read the binary buffer like: : : : : : : : : [code] : : : : procedure TPhone.serverAccept(Sender: TObject; : : : : ClientSocket: TCustomIpClient); : : : : var : : : : GetBuf : Array[0..255] of char; : : : : begin : : : : ClientSocket.ReceiveBuf(GetBuf,255); : : : : .... : : : : ... : : : : .. : : : : [/code] : : : : : : [b][red]This message was edited by netgert at 2004-2-18 6:50:0[/red][/b][hr] : : : : : : 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 [b]file of Byte[/b] 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 [b]file[/b] but then you have to use [b]reset(f, 1)[/b]. : : : : : : 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 : : : : : : : : : : : : : : : : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 6:7:22[/red][/b][hr] : : : : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 5:13:57[/red][/b][hr] : : : : : : : : : 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 ?:) : : : : : : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr] : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 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. : : [code] : : RegObj := TRegistry.Create; : : with RegObject do : : begin : : RootKey := HKEY_CURRENT_USER; : : OpenKey('MyKey', true); : : WriteString('MyValue', 'Some string'); : : end; : : RegObj.Free; : : [/code] : : 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 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 : :
: : [b][red]This message was edited by bogdanul2003 at 2004-2-20 4:55:18[/red][/b][hr] : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-19 8:1:16[/red][/b][hr] : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-19 7:37:43[/red][/b][hr] : : : : : You can determine the IP address of the computer. by the following procedure, using API calles: : : : : : : : : : : [code] : : : : : : : : : : 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; : : : : : : : : : : [/code] : : : : : You can read the binary buffer like: : : : : : : : : : : [code] : : : : : procedure TPhone.serverAccept(Sender: TObject; : : : : : ClientSocket: TCustomIpClient); : : : : : var : : : : : GetBuf : Array[0..255] of char; : : : : : begin : : : : : ClientSocket.ReceiveBuf(GetBuf,255); : : : : : .... : : : : : ... : : : : : .. : : : : : [/code] : : : : : : : [b][red]This message was edited by netgert at 2004-2-18 6:50:0[/red][/b][hr] : : : : : : : 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 [b]file of Byte[/b] 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 [b]file[/b] but then you have to use [b]reset(f, 1)[/b]. : : : : : : : 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 : : : : : : : : : : : : : : : : : : : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 6:7:22[/red][/b][hr] : : : : : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 5:13:57[/red][/b][hr] : : : : : : : : : : 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 ?:) : : : : : : : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr] : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 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. : : : [code] : : : RegObj := TRegistry.Create; : : : with RegObject do : : : begin : : : RootKey := HKEY_CURRENT_USER; : : : OpenKey('MyKey', true); : : : WriteString('MyValue', 'Some string'); : : : end; : : : RegObj.Free; : : : [/code] : : : 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 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.
Comments
:
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
[b][red]This message was edited by bogdanul2003 at 2004-2-18 5:13:57[/red][/b][hr]
: : 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
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 [b]file of Byte[/b] 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 [b]file[/b] but then you have to use [b]reset(f, 1)[/b].
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
: [b][red]This message was edited by bogdanul2003 at 2004-2-18 6:7:22[/red][/b][hr]
: [b][red]This message was edited by bogdanul2003 at 2004-2-18 5:13:57[/red][/b][hr]
: : : 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
:
:
:
[hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
: 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 [b]file of Byte[/b] 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 [b]file[/b] but then you have to use [b]reset(f, 1)[/b].
: 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
:
:
: : [b][red]This message was edited by bogdanul2003 at 2004-2-18 6:7:22[/red][/b][hr]
: : [b][red]This message was edited by bogdanul2003 at 2004-2-18 5:13:57[/red][/b][hr]
: : : : 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 ?:)
: [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
:
:
:
:
[code]
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;
[/code]
You can read the binary buffer like:
[code]
procedure TPhone.serverAccept(Sender: TObject;
ClientSocket: TCustomIpClient);
var
GetBuf : Array[0..255] of char;
begin
ClientSocket.ReceiveBuf(GetBuf,255);
....
...
..
[/code]
: : [b][red]This message was edited by netgert at 2004-2-18 6:50:0[/red][/b][hr]
: : 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 [b]file of Byte[/b] 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 [b]file[/b] but then you have to use [b]reset(f, 1)[/b].
: : 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
: :
: :
: : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 6:7:22[/red][/b][hr]
: : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 5:13:57[/red][/b][hr]
: : : : : 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 ?:)
: : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
: :
: :
: :
: :
:
:
[b][red]This message was edited by bogdanul2003 at 2004-2-19 7:37:43[/red][/b][hr]
: You can determine the IP address of the computer. by the following procedure, using API calles:
:
: [code]
:
: 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;
:
: [/code]
: You can read the binary buffer like:
:
: [code]
: procedure TPhone.serverAccept(Sender: TObject;
: ClientSocket: TCustomIpClient);
: var
: GetBuf : Array[0..255] of char;
: begin
: ClientSocket.ReceiveBuf(GetBuf,255);
: ....
: ...
: ..
: [/code]
: : : [b][red]This message was edited by netgert at 2004-2-18 6:50:0[/red][/b][hr]
: : : 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 [b]file of Byte[/b] 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 [b]file[/b] but then you have to use [b]reset(f, 1)[/b].
: : : 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
: : :
: : :
: : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 6:7:22[/red][/b][hr]
: : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 5:13:57[/red][/b][hr]
: : : : : : 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 ?:)
: : : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
: : :
: : :
: : :
: : :
: :
: :
:
:
How can i change to a specified key or insert a string value in to a key name ?(registers)
bytheway 10x for helping me
: [b][red]This message was edited by bogdanul2003 at 2004-2-19 7:37:43[/red][/b][hr]
: : You can determine the IP address of the computer. by the following procedure, using API calles:
: :
: : [code]
: :
: : 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;
: :
: : [/code]
: : You can read the binary buffer like:
: :
: : [code]
: : procedure TPhone.serverAccept(Sender: TObject;
: : ClientSocket: TCustomIpClient);
: : var
: : GetBuf : Array[0..255] of char;
: : begin
: : ClientSocket.ReceiveBuf(GetBuf,255);
: : ....
: : ...
: : ..
: : [/code]
: : : : [b][red]This message was edited by netgert at 2004-2-18 6:50:0[/red][/b][hr]
: : : : 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 [b]file of Byte[/b] 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 [b]file[/b] but then you have to use [b]reset(f, 1)[/b].
: : : : 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
: : : :
: : : :
: : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 6:7:22[/red][/b][hr]
: : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 5:13:57[/red][/b][hr]
: : : : : : : 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 ?:)
: : : : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
: : : :
: : : :
: : : :
: : : :
: : :
: : :
: :
: :
:
: 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.
[code]
RegObj := TRegistry.Create;
with RegObject do
begin
RootKey := HKEY_CURRENT_USER;
OpenKey('MyKey', true);
WriteString('MyValue', 'Some string');
end;
RegObj.Free;
[/code]
More info on the TRegistry object can be found in the help files.
: : [b][red]This message was edited by bogdanul2003 at 2004-2-19 8:1:16[/red][/b][hr]
: : [b][red]This message was edited by bogdanul2003 at 2004-2-19 7:37:43[/red][/b][hr]
: : : You can determine the IP address of the computer. by the following procedure, using API calles:
: : :
: : : [code]
: : :
: : : 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;
: : :
: : : [/code]
: : : You can read the binary buffer like:
: : :
: : : [code]
: : : procedure TPhone.serverAccept(Sender: TObject;
: : : ClientSocket: TCustomIpClient);
: : : var
: : : GetBuf : Array[0..255] of char;
: : : begin
: : : ClientSocket.ReceiveBuf(GetBuf,255);
: : : ....
: : : ...
: : : ..
: : : [/code]
: : : : : [b][red]This message was edited by netgert at 2004-2-18 6:50:0[/red][/b][hr]
: : : : : 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 [b]file of Byte[/b] 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 [b]file[/b] but then you have to use [b]reset(f, 1)[/b].
: : : : : 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
: : : : :
: : : : :
: : : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 6:7:22[/red][/b][hr]
: : : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 5:13:57[/red][/b][hr]
: : : : : : : : 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 ?:)
: : : : : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
: : : : :
: : : : :
: : : : :
: : : : :
: : : :
: : : :
: : :
: : :
: :
: : 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.
: [code]
: RegObj := TRegistry.Create;
: with RegObject do
: begin
: RootKey := HKEY_CURRENT_USER;
: OpenKey('MyKey', true);
: WriteString('MyValue', 'Some string');
: end;
: RegObj.Free;
: [/code]
: 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
10x
: : : [b][red]This message was edited by bogdanul2003 at 2004-2-19 8:1:16[/red][/b][hr]
: : : [b][red]This message was edited by bogdanul2003 at 2004-2-19 7:37:43[/red][/b][hr]
: : : : You can determine the IP address of the computer. by the following procedure, using API calles:
: : : :
: : : : [code]
: : : :
: : : : 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;
: : : :
: : : : [/code]
: : : : You can read the binary buffer like:
: : : :
: : : : [code]
: : : : procedure TPhone.serverAccept(Sender: TObject;
: : : : ClientSocket: TCustomIpClient);
: : : : var
: : : : GetBuf : Array[0..255] of char;
: : : : begin
: : : : ClientSocket.ReceiveBuf(GetBuf,255);
: : : : ....
: : : : ...
: : : : ..
: : : : [/code]
: : : : : : [b][red]This message was edited by netgert at 2004-2-18 6:50:0[/red][/b][hr]
: : : : : : 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 [b]file of Byte[/b] 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 [b]file[/b] but then you have to use [b]reset(f, 1)[/b].
: : : : : : 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
: : : : : :
: : : : : :
: : : : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 6:7:22[/red][/b][hr]
: : : : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 5:13:57[/red][/b][hr]
: : : : : : : : : 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 ?:)
: : : : : : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
: : : : : :
: : : : : :
: : : : : :
: : : : : :
: : : : :
: : : : :
: : : :
: : : :
: : :
: : : 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.
: : [code]
: : RegObj := TRegistry.Create;
: : with RegObject do
: : begin
: : RootKey := HKEY_CURRENT_USER;
: : OpenKey('MyKey', true);
: : WriteString('MyValue', 'Some string');
: : end;
: : RegObj.Free;
: : [/code]
: : 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
: 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
:
:
: : : : [b][red]This message was edited by bogdanul2003 at 2004-2-19 8:1:16[/red][/b][hr]
: : : : [b][red]This message was edited by bogdanul2003 at 2004-2-19 7:37:43[/red][/b][hr]
: : : : : You can determine the IP address of the computer. by the following procedure, using API calles:
: : : : :
: : : : : [code]
: : : : :
: : : : : 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;
: : : : :
: : : : : [/code]
: : : : : You can read the binary buffer like:
: : : : :
: : : : : [code]
: : : : : procedure TPhone.serverAccept(Sender: TObject;
: : : : : ClientSocket: TCustomIpClient);
: : : : : var
: : : : : GetBuf : Array[0..255] of char;
: : : : : begin
: : : : : ClientSocket.ReceiveBuf(GetBuf,255);
: : : : : ....
: : : : : ...
: : : : : ..
: : : : : [/code]
: : : : : : : [b][red]This message was edited by netgert at 2004-2-18 6:50:0[/red][/b][hr]
: : : : : : : 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 [b]file of Byte[/b] 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 [b]file[/b] but then you have to use [b]reset(f, 1)[/b].
: : : : : : : 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
: : : : : : :
: : : : : : :
: : : : : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 6:7:22[/red][/b][hr]
: : : : : : : : [b][red]This message was edited by bogdanul2003 at 2004-2-18 5:13:57[/red][/b][hr]
: : : : : : : : : : 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 ?:)
: : : : : : : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
: : : : : : :
: : : : : : :
: : : : : : :
: : : : : : :
: : : : : :
: : : : : :
: : : : :
: : : : :
: : : :
: : : : 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.
: : : [code]
: : : RegObj := TRegistry.Create;
: : : with RegObject do
: : : begin
: : : RootKey := HKEY_CURRENT_USER;
: : : OpenKey('MyKey', true);
: : : WriteString('MyValue', 'Some string');
: : : end;
: : : RegObj.Free;
: : : [/code]
: : : 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
: : 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.