creating a socket to connect to existing servers

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

maverickalex
Posts: 108
Joined: Sun Mar 15, 2009 11:51 pm

Re: creating a socket to connect to existing servers

Post by maverickalex » Fri Nov 12, 2010 10:20 am

The 100miliseconds wait was already in the script, so i left it in. just for my info, in the example previous the sockets are defined as pSocket and Ssocket. Are these general names or Peer and Server socket? or just general names given to a socket.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: creating a socket to connect to existing servers

Post by Mark » Sat Nov 13, 2010 12:26 am

maverickalex,

sSocket is just a pointer to the items in the list 'the openSockets'. I don't know why someone decided to give it the prefix 's'. The p in pSocket stands for "parameter".

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

maverickalex
Posts: 108
Joined: Sun Mar 15, 2009 11:51 pm

Re: creating a socket to connect to existing servers

Post by maverickalex » Sat Nov 13, 2010 8:59 pm

when i run the socket i get "failed to load tree" error in messge box?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: creating a socket to connect to existing servers

Post by Mark » Sat Nov 13, 2010 11:05 pm

maverickalex,

Do you have more information?

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

maverickalex
Posts: 108
Joined: Sun Mar 15, 2009 11:51 pm

Re: creating a socket to connect to existing servers

Post by maverickalex » Sat Nov 27, 2010 8:24 pm

Just that really, when i run the ap i see it connect but don't know how to grab the data and obtain the info i need

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: creating a socket to connect to existing servers

Post by Mark » Sun Nov 28, 2010 2:26 am

Dear maverickalex,

I'd be happy to help you, but you really need to provide more info.

For example, I should not have to ask you whether the gotPacket handler actually runs and, if it does, you should post (part of) the log here. Don't make me ask for everything, I don't have the time for that.

Best regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

maverickalex
Posts: 108
Joined: Sun Mar 15, 2009 11:51 pm

Re: creating a socket to connect to existing servers

Post by maverickalex » Mon Nov 29, 2010 4:55 pm

i dont get anything, only error message "tree not made"

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: creating a socket to connect to existing servers

Post by Mark » Mon Nov 29, 2010 5:13 pm

Mav

and can't you explain how you get this error, where you see this exactly, when, which script, which variable, whatever?

I'm losing my patience with you. I don't feel much like helping you anymore.

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

maverickalex
Posts: 108
Joined: Sun Mar 15, 2009 11:51 pm

Re: creating a socket to connect to existing servers

Post by maverickalex » Mon Nov 29, 2010 6:09 pm

I apologise, i learn much faster when following an example ans seeing it brought to life in front of me.

You said earlier you knew exactly what i wanted and how to do it?

If you could show me what i needed then i could see where i have been going wrong. This makes it easier to learn.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: creating a socket to connect to existing servers

Post by Mark » Mon Nov 29, 2010 6:40 pm

mav,

It is simple. If you have the patience to answer my questions, then you will get somewhere, you will learn someting, and next time you can do it on your own. If you refuse to answer my questions, then I won't help you.

Yes, I could do all of this on my own, but I have a programming company and am on this forum just to help out people rather than doing their projects for them.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

maverickalex
Posts: 108
Joined: Sun Mar 15, 2009 11:51 pm

Re: creating a socket to connect to existing servers

Post by maverickalex » Mon Nov 29, 2010 8:56 pm

Its a question of understanding the questions you pose and then finding where the answers lie.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: creating a socket to connect to existing servers

Post by Mark » Mon Nov 29, 2010 9:38 pm

Mav,

My questions are easy. I've done this for 20+ years. I know how this works, step by step. If you don't understand my questions, then show some effort and study until you understand them.

I won't be answering this thread anymore, unless you read back and provide the information I need to help you.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

maverickalex
Posts: 108
Joined: Sun Mar 15, 2009 11:51 pm

Re: creating a socket to connect to existing servers

Post by maverickalex » Tue Nov 30, 2010 1:40 pm

deleted!
Last edited by maverickalex on Sun Dec 05, 2010 10:33 am, edited 1 time in total.

maverickalex
Posts: 108
Joined: Sun Mar 15, 2009 11:51 pm

Re: creating a socket to connect to existing servers

Post by maverickalex » Sun Dec 05, 2010 10:33 am

Mark wrote:Hi Alex,

First, you need to get the documentation of those servers. You need to know the exact protocol.

A protocol contains port information, commands to tell the server that your client software is genuine, more commands to communicate with the server and the complete specifications of the (xml) data.

As long as you don't have that, don't try it.

Best regards
Mark

I have successfully used Putty a free telnet client to connect to flightgear

i used the "get" command.

Image

i need to scrap all the attempted starts i made and try again.

At least i know from this test that the FG internal server is working and does indeed send the correct info. I just need to sort out doing it in Rev now!

maverickalex
Posts: 108
Joined: Sun Mar 15, 2009 11:51 pm

Re: creating a socket to connect to existing servers

Post by maverickalex » Mon Dec 06, 2010 7:28 am

i have started again. at the moment i have one connect button and on field. "callsign"

can you tell me am i now on the right track.

Code: Select all

on mouseUp
    if the label of me = "connect" then
    set the label of me to "disconnect"
    startconnection
end if
end mouseUp

on startconnection 
  open socket to "127.0.0.1:5501" with message connected
end startconnection

on connected theSocket
  put "data" & return & "data" & return & "get sim/multiplay/callsign" & return into mess
  write mess to Socket theSocket until crlf
   read from socket theSocket until return with message "callsignResult"
end connected

on callsignResult theSocket theMessage
   put theMessage into field "callsign"
end callsignResult
Thanks

Alex

Post Reply