Delphi Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreDelphi Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 18th, 2006, 07:14 PM
Protocol2511 Protocol2511 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Posts: 6 Protocol2511 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 56 m 37 sec
Reputation Power: 0
Socket connection / read only properites

Code:
procedure TFrmMain.Connect1Click(Sender: TObject);
var
i :integer ;
ipme:string;
portme:string;
        begin

i:=frmmain.sinlst.Selected.Index;
ipme:=  frmmain.sinlst.Selected.Caption ;
portme:= frmmain.sinlst.Selected.SubItems.Strings[i];

{
showmessage (frmmain.sinlst.Selected.Caption);
showmessage (frmmain.sinlst.Selected.SubItems.Strings[i]) ;  }

CNXsocket.Socket.RemoteAddress:=   (strtoint(ipme));//this line errors
CNXsocket.Socket.RemotePort :=    (strtoint(portme));  //this line errors
end;


i have tried to get items from my listview and connect to them but i get can not assign to read only properity i have tried coding it in different ways but i can not find a solution to this problem thanks in advanced

Reply With Quote
  #2  
Old February 18th, 2006, 11:27 PM
michaelm michaelm is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 52 michaelm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 49 m 33 sec
Reputation Power: 3
Quote:
Originally Posted by Protocol2511
Code:
...
CNXsocket.Socket.RemoteAddress:=   (strtoint(ipme));//this line errors
CNXsocket.Socket.RemotePort :=    (strtoint(portme));  //this line errors
...


i have tried to get items from my listview and connect to them but i get can not assign to read only properity i have tried coding it in different ways but i can not find a solution to this problem thanks in advanced




what class/component is CNXsocket?

My guess is that you are trying to use a TServerSocket when you should be using a TClientSocket.

with a TServerSocket, you cannot (of course) assign the RemoteAddress and RemotePort. Those things are decided by the incomming client alone (ex: a webserver may run on port 80, but the client software (usually a browser) is free to use any port it wishes on it's own end... The client will also determine its own IP address. The ServerSocket has no control over this.

The RemoteAddress and RemotePort read-only properties simply tell the server details about the incomming clients connection.

In order to specify which ports to connect to, you can use the TServerSocket.Port and TClientSocket.Port properties.


regards,

-Michael

Reply With Quote
  #3  
Old February 19th, 2006, 12:02 PM
Protocol2511 Protocol2511 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Posts: 6 Protocol2511 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 56 m 37 sec
Reputation Power: 0
thanks for the reply it was very useful i have managed to sort most of my problem out, CNXsocket was a server socket hehe

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreDelphi Programming > Socket connection / read only properites


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT