New topic: 

TCP Socket Write and Listen

<http://forums.realsoftware.com/viewtopic.php?t=46238>

         Page 1 of 1
   [ 4 posts ]                 Previous topic | Next topic          Author  
Message        mapmusic          Post subject: TCP Socket Write and 
ListenPosted: Fri Dec 14, 2012 9:25 am                         
Joined: Tue Oct 30, 2012 4:23 am
Posts: 4                Hello,

Network novice question.

I want to control application which supports commands over TCP.
After command was sent I need to read result on same port.

Need I use 2 TCPSockets or can I use 1 for Write and Listen ?

Example : I need to send string "STATUS" to app on TCP port 7001 and need to 
receive results on same port.

Code examples are welcome.

Thanks

Martin      
_________________
---

@MacOS 10.7.5/MBPro  
                             Top                Bob Keeney          Post 
subject: Re: TCP Socket Write and ListenPosted: Fri Dec 14, 2012 9:29 am        
                         
Joined: Fri Sep 30, 2005 11:48 am
Posts: 3326
Location: Lenexa, KS                If it's the same port then you only need 
one socket.      
_________________
Bob K.

Don't Forget Your BKeeney! 
Real Studio training day at Real World 2013.  
http://www.bkeeney.com/realbasic-training-section/training-2013  
                             Top                mapmusic          Post subject: 
Re: TCP Socket Write and ListenPosted: Fri Dec 14, 2012 10:21 am                
         
Joined: Tue Oct 30, 2012 4:23 am
Posts: 4                Thanks Bob,

It does not work for me. Bellow is my workflow.

I have set TCPsocket with Address  192.168.x.1 and port 7001 where 192.168.x.1 
is PC with app which I need to control over TCP.
Computer with MyApp is on 192.168.x.2
on start of app I use Socket.Connect
I am sending command with Socket.Write("Command")
And on Event Socket.DataAvailable I have code to show buffer: 
TextField.AppendText (Socket.ReadAll))

Is it way how it should work ?
Need i use Listen Method ?
Need I set my IP somewhere ?

Thanks

Martin      
_________________
---

@MacOS 10.7.5/MBPro  
                             Top                Bob Keeney          Post 
subject: Re: TCP Socket Write and ListenPosted: Fri Dec 14, 2012 12:08 pm       
                          
Joined: Fri Sep 30, 2005 11:48 am
Posts: 3326
Location: Lenexa, KS                I guess the first question to ask is do you 
ever really connect to the other PC?  Do you have anything in the Connected 
Event http://docs.realsoftware.com/index.php/ ... .Connected or in the Error 
event http://docs.realsoftware.com/index.php/SocketCore.Error?      
_________________
Bob K.

Don't Forget Your BKeeney! 
Real Studio training day at Real World 2013.  
http://www.bkeeney.com/realbasic-training-section/training-2013  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 4 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to