KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Kixforms Sockets : Discussion
Goto page Previous  1, 2, 3, 4, 5, 6  Next
 
Post new topic   Reply to topic    KiXforms Forum Index -> Discussion
View previous topic :: View next topic  
Author Message
Jochen
KiXforms Devotee
KiXforms Devotee


Joined: 05 Mar 2003
Posts: 1204
Location: Stuttgart, Germany

PostPosted: Thu Aug 05, 2004 7:41 am    Post subject: Reply with quote

I for myself think that

.Send
.Receive

are more intuitive ...

How about adding .Broadcast and .Listen
Like having the possibility for a LAN based game not to necessarily know the IP's

_________________
Jochen

Tell me, and I will forget.
Show me, and I may remember.
Involve me, and I will understand.
Back to top
View user's profile Send private message MSN Messenger
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Thu Aug 05, 2004 8:07 am    Post subject: Reply with quote

about connect/disconnect...
it all depends.

if you automatically create the socket and open it and also automatically close it, then I think both open/close and connect/disconnect pairs suite ok.

also, the terminology is a question mark in here...
are we talking about opening a socket or opening a connection.
basically open can mean both.
on the other hand $socket.open() would sound little misleading if connection is established at the same time.

on the listening side though, only open is suitable, as listener don't connect anywhere.

_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Wed Jun 28, 2006 3:29 pm    Post subject: Sockets Reply with quote

I've tried to use the Socket support on a simple webpage connect script but can not get it to work, mind looking at my code ?

Code:

$system = CreateObject("kixtart.system")

Connect

Function Connect()
  $socket = $system.socket()
  $socket.Blocking = 0
  $socket.RemoteAddress = "194.109.6.92"
  $socket.RemotePort = 80
  $socket.OnConnect = "OnConnect($$system.eventobject)"
  $socket.OnReceive = "OnReceive($$system.eventobject)"
  $socket.OnDisconnect = "OnDisconnect($$system.eventobject)"
  $socket.Connect()
EndFunction

Function OnConnect($socket)
  ? "Function OnConnect Called"
  If $system.error
    ? $system.serror
    Return
  EndIf
  If $socket
    ? "Socket Connected"
  Else
    ? "Socket Not connected"
  EndIf
EndFunction

Function OnReceive($socket)
  ? "Function OnReceive Called"
  Dim $packet
  If $socket
    ? "Socket OK"
    $packet = $socket.receive()
    If $packet
      ? "Packet OK"
    EndIf
  EndIf
EndFunction

Function OnDisconnect($socket)
  ? $system.serror
EndFunction

_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Thu Jun 29, 2006 7:12 am    Post subject: Reply with quote

I tried also with kf .net sockets and failed too.

I think there is some control characters that the client needs to pass to the server to "activate" the connection.

_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Thu Jun 29, 2006 8:11 am    Post subject: Reply with quote

Could be, but the socket stuff I've written in mirc doesn't pass anything and that does work. Although with mirc you have to name the socket for instance:

Code:

sockopen "name_here" address port

_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
Jochen
KiXforms Devotee
KiXforms Devotee


Joined: 05 Mar 2003
Posts: 1204
Location: Stuttgart, Germany

PostPosted: Thu Jun 29, 2006 9:05 am    Post subject: Reply with quote

udf names = event names

a bit smelly imo.
Not that it would prevent functionality, but still I would flinch from doing that.
Well, if at all, I think I have to blame Shawn for that, as he wrote the template Wink

Right, what is 'listening' on the other side? Is it really a webpage or is it another kf socket script? If first, that could be the problem (incompatibility)

_________________
Jochen

Tell me, and I will forget.
Show me, and I may remember.
Involve me, and I will understand.
Back to top
View user's profile Send private message MSN Messenger
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Thu Jun 29, 2006 11:28 am    Post subject: Reply with quote

Yeah it's a website, I tried many different websites but all the same thing.
I agree that there could be a problem there but at least there should be some kind of answer, like failed to connect or something similar.

_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Thu Jun 29, 2006 11:31 am    Post subject: Reply with quote

I know its easy to forget but ...

1) Kixtart doesn't natively support COM events.

2) Socket events are just like any other kind of window event.

3) In order to pump events we ... DoEvents.
Back to top
View user's profile Send private message
Jochen
KiXforms Devotee
KiXforms Devotee


Joined: 05 Mar 2003
Posts: 1204
Location: Stuttgart, Germany

PostPosted: Thu Jun 29, 2006 11:43 am    Post subject: Reply with quote

Ahahahahahahah .... errr ... there is no DoEvents loop in your script ?
Embarassed

_________________
Jochen

Tell me, and I will forget.
Show me, and I may remember.
Involve me, and I will understand.
Back to top
View user's profile Send private message MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Thu Jun 29, 2006 1:13 pm    Post subject: Reply with quote

ja, what you can do is something like this:

Code:

Break On

$system = CreateObject("kixtart.system")

Connect

$Running = 1
While $Running
 $= Execute($System.DoEvents)
Loop

Exit 0

Function Connect()
  $socket = $system.socket()
  $socket.Blocking = 0
  $socket.RemoteAddress = "www.kixtart.org"
  $socket.RemotePort = 80
  $socket.OnConnect = "OnConnect($$system.eventobject)"
  $socket.OnReceive = "OnReceive($$system.eventobject)"
  $socket.OnDisconnect = "OnDisconnect($$system.eventobject)"
  $socket.Connect()
EndFunction

Function OnConnect($socket)
  ? "Function OnConnect Called"
  If $system.error
    ? $system.serror
    Return
  EndIf
  If $socket
    ? "Socket Connected"
  Else
    ? "Socket Not connected"
  EndIf
EndFunction

Function OnReceive($socket)
  ? "Function OnReceive Called"
  Dim $packet
  If $socket
    ? "Socket OK"
    $packet = $socket.receive()
    If $packet
      ? "Packet OK"
    EndIf
  EndIf
EndFunction

Function OnDisconnect($socket)
 $Running = 0
  ? $system.serror
EndFunction
Back to top
View user's profile Send private message
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Thu Jun 29, 2006 3:12 pm    Post subject: Reply with quote

Off course, I forgot the DoEvents Smile Thx guys Smile
_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Thu Jun 29, 2006 3:25 pm    Post subject: Reply with quote

Still does nothing though, now just gets into an infinite loop....
_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
peaps
KiXforms Follower
KiXforms Follower


Joined: 17 Jul 2006
Posts: 26
Location: Storrington, West Sussex, UK

PostPosted: Sat Aug 26, 2006 11:41 am    Post subject: Error connecting Reply with quote

I have tried both Echo and Chat/Server/Client, but whenever I use the client to connect to the server I get this error message:

A non-blocking socket operation could not be completed immediately.


Any ideas what this is talking about? I am using STOCK code, not altered in any way.

Thanks,
Back to top
View user's profile Send private message Visit poster's website
peaps
KiXforms Follower
KiXforms Follower


Joined: 17 Jul 2006
Posts: 26
Location: Storrington, West Sussex, UK

PostPosted: Mon Aug 28, 2006 9:36 pm    Post subject: Reply with quote

Would anyone else be able to try the socket pack and see if they get the same error?

It is located here: http://www.kixforms.org/assets/files/kixforms/developer/sockets.zip

Thanks
Back to top
View user's profile Send private message Visit poster's website
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Mon Aug 28, 2006 11:03 pm    Post subject: Reply with quote

I am getting the same error, I suspect that something has changed with windows since I last ran these scripts in addition I donít think there has been much interest in sockets so things have probably not been updated.
_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Discussion All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6  Next
Page 4 of 6

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group