I have searching for hours on the internet to solve my problem.
But no luck!. I hope someone on EE can help me to solve my problem. I really need your help I can't solve it on my own.
I have made a Telnet-programm. The user can enter an IPaddress and Portnumber (in the editboxes) to connect to a server.
The Ipadres and the Portnumber entered in the editboxes are stored in 2 variables:
The problem is with the ConnectPortNum, how can i pass the
variable ConnectPortNum to this line in the procedure MakeConnect:
pServAddr := getservbyname('telnet', 'tcp'); <=====
if pServAddr <> nil then
if deb then
Log('Remote Service Info.:');
Log(' Name: ' + PChar(pServAddr^.s_name));
Log(' Port: ' + Format('%d', [ntohs (pServAddr^.s_port)]));
usPort := pServAddr^.s_port;
RemoteAddr.sin_family := AF_INET;
RemoteAddr.sin_addr.s_addr := ina.s_addr;
RemoteAddr.sin_port := usPort;
I have searched for the syntax on internet:
PServAddr := ( service, protocol )
Does anyone know how I can pass the ConnectPorNum
to the MakeConnect-procedure?