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,