Page 1 of 1 1
Topic Options
#213270 - 2018-04-23 04:20 PM Socket error in KixForms 2.47.5?
Schuliebug Offline
Hey THIS is FUN
*****

Registered: 2002-01-18
Posts: 379
Loc: Netherlands
Hi,

It's been a while since I programmed in Kix32 but I'm trying to start again with an old script of mine which uses a service part and a client part. The service part seems to work fine, but the client connects and errors out after a while. The code I'm using is:

 Code:
Function fnServiceConnect($Request)
	; Local variables..
	Dim $ServiceAddress,$ServicePort,$

	$ServiceAddress=fnGetMUI('DOCClient.ServiceAddress')
	$ServicePort=fnGetMUI('DOCClient.ServicePort')

	; Create socket..
	$Socket=$System.Socket()
	If $Socket
		$Socket.blocking=0
		$Socket.onconnect="$$=fnOnConnect($$System.Sender,'"+$Request+"')"
		$Socket.onreceive="$$=fnOnReceive($$System.Sender)"
		$Socket.ondisconnect="$=fnOnDisconnect($$System.Sender)"
		$Socket.remoteaddress=$ServiceAddress
		$Socket.remoteport=$ServicePort
		$Socket.connect()
	EndIf
EndFunction

Function fnOnConnect($Socket,$Request)
	; Local variables..
	Dim $

	If $Socket
		; Send message..
		$Socket.Send($Request)
		Sleep 0.05
	EndIf
EndFunction

Function fnOnReceive($Socket)
	; Local variables..
	Dim $GroupDN,$GroupObj,$Tag,$UserObj,$

	If $Socket
		; Retrieve data from socket and close socket..
		$OnReceive=$Socket.Receive()
		$Socket.Disconnect()
		$Socket.Close()
		$Socket=0

		; redim granted/delegated users..
		Redim $GrantedUsers[]
		Redim $DelegatedUsers[]
		
		; Check if received data is correct..
		$OnRecieveArray=Split($OnReceive,',')
		Select
		  Case Left($OnReceive,10)='1,Connect,'

		  Case Left($OnReceive,9)='1,Result,'

		  Case Left($OnReceive,7)='1,Quit,'
		Select
	EndIf
EndFunction


This function is used to connect to the $ServiceAddress and ServicePort, which works fine using the script SocketCommander.kix. The fnOnConnect is started when the connect() is run, but the fnOnReceive is never run?

Anybody any suggestions? I'm running on Windows 10 Enterprise build 1709, the service is running on Windows Server 2012.
_________________________
Kind regards,

Top
#213271 - 2018-04-23 04:26 PM Re: Socket error in KixForms 2.47.5? [Re: Schuliebug]
Arend_ Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
Windows 10 Firewall \:\)
Top
#213272 - 2018-04-23 04:33 PM Re: Socket error in KixForms 2.47.5? [Re: Arend_]
Schuliebug Offline
Hey THIS is FUN
*****

Registered: 2002-01-18
Posts: 379
Loc: Netherlands
Nope, it has to do with KixForms.dll. I tried version 2.47.6.0 and this one works! As stated in another thread, documentation would be very handy.
_________________________
Kind regards,

Top
#213273 - 2018-04-25 03:02 AM Re: Socket error in KixForms 2.47.5? [Re: Schuliebug]
AndreLuiz Offline
Getting the hang of it

Registered: 2015-10-07
Posts: 89
Loc: Brasil, João pessoa
[PTBR]
Já aproveitando o tópico, queria que alguém por favor me dê uma ajuda sobre o Socket!!
Eu quero criar uma aplicação em uma maquina "A", que vai enviar informações para a maquina "B".

E não sei nada de socket, por favor me peço uma ajuda sobre isso, é muito importante!!
E outra, eu posso fazer teste na mesma maquina em quanto o meu server não fica pronto?
desde já agradeço!!

[ENG]
Already taking advantage of the topic, I wanted someone to please give me a help on Socket !!
I want to create an application on an "A" machine, which will send information to machine "B".

And I do not know anything about socket, please ask me for a help on this, it's very important !!
And another, can I test on the same machine when my server is not ready?
Thank you very much in advance!!


Edited by AndreLuiz (2018-04-25 03:03 AM)

Top
Page 1 of 1 1


Moderator:  ShaneEP, Mart, Radimus, Jochen, Allen, Glenn Barnas 
Hop to:
Shout Box

Who's Online
0 registered and 569 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.054 seconds in which 0.027 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org