Schuliebug
(Hey THIS is FUN)
2018-04-23 04:20 PM
Socket error in KixForms 2.47.5?

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.


Arend_
(MM club member)
2018-04-23 04:26 PM
Re: Socket error in KixForms 2.47.5?

Windows 10 Firewall \:\)

Schuliebug
(Hey THIS is FUN)
2018-04-23 04:33 PM
Re: Socket error in KixForms 2.47.5?

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.

AndreLuiz
(Getting the hang of it)
2018-04-25 03:02 AM
Re: Socket error in KixForms 2.47.5?

[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!!