error 8982

Posted by bart.syryn on 04-Jun-2014 08:58

Hi folks, Recently we've build the functionality to send text-messages (SMS) to mobile phones in our application. It's the first time I've programmed HTTP Post / Get, and I don't understand it all. When the user sends one message, it's all fine. But when the user sends i.e. 300 text-messages to 300 phones we get error 8982. The exact error is : Invalid event-procedure context encountered when trying to invoke event procedure 'getResponse'. (8982). The functionality is build in a .w window. It seems that when all the message are send and the window gets closed, the session is still sending messages but the getResponse procedure isn't available anymore (it's in the .w). Strange because in the code there's a WAIT-FOR READ-RESPONSE OF gsocket. I'm surely missing something, but I can't find out what exactly. In attachment I placed the code (it's an include). Hopefully someone is willing to have a look at it and help me out. This is on OE11.3.2 - windows 7. Kind regards Bart Syryn

Posted by bart.syryn on 06-Jun-2014 10:40

Hi Peter,

I finally found it. You've pointed me in the right direction, saying that the socket maybe still open. Somewhere in the code there's a test, IF G-listto = "" THEN NEXT. So when there was no Phone number, than the message isn't send and the program goes on with the next number. But at that point, the socket was open and a new one was created. So I changed it to DISCONNECT - DELETE and then NEXT, and it solved my problem.

Thanks for pointing me in the correct direction.

Kind regards

Bart Syryn

All Replies

Posted by Peter Judge on 04-Jun-2014 09:10

Hi Bart,
 
Is the socket in the .w too? If I had to guess, I would say that the socket is not being closed/cleanedup (since the code to do that is after the wait-for).
 
What happens if you delete G-Socket when the windows closes?  
 
-- peter
 
[collapse]
From: bart.syryn [mailto:bounce-bartsyryn@community.progress.com]
Sent: Wednesday, 04 June, 2014 09:59
To: TU.OE.Development@community.progress.com
Subject: [Technical Users - OE Development] error 8982
 
Hi folks, Recently we've build the functionality to send text-messages (SMS) to mobile phones in our application. It's the first time I've programmed HTTP Post / Get, and I don't understand it all. When the user sends one message, it's all fine. But when the user sends i.e. 300 text-messages to 300 phones we get error 8982. The exact error is : Invalid event-procedure context encountered when trying to invoke event procedure 'getResponse'. (8982). The functionality is build in a .w window. It seems that when all the message are send and the window gets closed, the session is still sending messages but the getResponse procedure isn't available anymore (it's in the .w). Strange because in the code there's a WAIT-FOR READ-RESPONSE OF gsocket. I'm surely missing something, but I can't find out what exactly. In attachment I placed the code (it's an include). Hopefully someone is willing to have a look at it and help me out. This is on OE11.3.2 - windows 7. Kind regards Bart Syryn
[/collapse]

Posted by bart.syryn on 04-Jun-2014 09:47

Hi Peter,

Thanks for replying, but I don't understand your suggestion. Do you suggest to place the delete G-socket in the main block (on close of this procedure ) ?  The socket is created in the loop in procedure : http-sendsms.

Kind regards,

Bart S.

Posted by Peter Judge on 04-Jun-2014 09:56

Hi Bart,

In the code you sent (which I've trimmed down), there's a G-Socket:DISCONNECT() line near the end (edit: line 19). I was wondering whether that line of code was executed when the user just closes the window (ie via [X] or some other means). If it does not, then you should clean up the socket on the window's ON CLOSE OF THIS-PROCEDURE trigger (or similar). I suspect that the socket is still open, even when the window has closed, because that line (19) deleting the socket in http-sendsms fails to run.

PROCEDURE http-sendsms :
	ASSIGN P-error     = FALSE.
	FOR EACH ttsendsms WHERE ttsendsms.sendsms:
	  CREATE SOCKET G-Socket.
	  G-Socket:CONNECT('-H ' + G-Host + ' -S 80') NO-ERROR.

	  G-Socket:SET-READ-RESPONSE-PROCEDURE('getResponse',THIS-PROCEDURE).

	   /*  snipped a lot */
	  IF G-postdata <> ? THEN
		 DO: RUN PostRequest (INPUT '/send.php', 
							  INPUT G-postData).
			 WAIT-FOR READ-RESPONSE OF G-Socket.  
		 END.

	  IF VALID-HANDLE(P-statushandle) 
		 THEN ASSIGN P-statushandle:SCREEN-VALUE = "Versturen: " + STRING(G-totaal-sendsmsen) + "/" + STRING(P-aantalsms).

	  G-Socket:DISCONNECT() NO-ERROR.
	  DELETE OBJECT G-Socket.
	END.
END PROCEDURE.



Posted by bart.syryn on 04-Jun-2014 12:58

Hi Peter,

When all the messages are send,there's a message-box that gives the information and after pressing 'ok' the window is closed programmaticaly.

I've placed the two lines (G-socket:disconnect and Delete object G-socket) in the window's ON CLOSE OF THIS-PROCEDURE, but that didn't solve the problem ...

Any other suggestions ...

Kind regards

Bart S.

Posted by bart.syryn on 06-Jun-2014 10:40

Hi Peter,

I finally found it. You've pointed me in the right direction, saying that the socket maybe still open. Somewhere in the code there's a test, IF G-listto = "" THEN NEXT. So when there was no Phone number, than the message isn't send and the program goes on with the next number. But at that point, the socket was open and a new one was created. So I changed it to DISCONNECT - DELETE and then NEXT, and it solved my problem.

Thanks for pointing me in the correct direction.

Kind regards

Bart Syryn

Posted by Peter Judge on 06-Jun-2014 12:42

Fantastic!
 
Glad to be of some help,
 
-- peter
 
[collapse]
From: bart.syryn [mailto:bounce-bartsyryn@community.progress.com]
Sent: Friday, 06 June, 2014 11:41
To: TU.OE.Development@community.progress.com
Subject: RE: [Technical Users - OE Development] error 8982
 
Reply by bart.syryn

Hi Peter,

I finally found it. You've pointed me in the right direction, saying that the socket maybe still open. Somewhere in the code there's a test, IF G-listto = "" THEN NEXT. So when there was no Phone number, than the message isn't send and the program goes on with the next number. But at that point, the socket was open and a new one was created. So I changed it to DISCONNECT - DELETE and then NEXT, and it solved my problem.

Thanks for pointing me in the correct direction.

Kind regards

Bart Syryn

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

This thread is closed