Bufferwave of SOCKITopenconnection is empty, Igor crashes by using SOCKITsendnrecv

Project:SOCKIT - a TCP/IP client for speaking and listening to network sockets using IGOR Pro
Version:IGOR.5.00.x-1.x-dev
Component:Code
Category:support request
Priority:critical
Assigned:andyfaff
Status:closed
Description

OS: WinXP prof., Igor: 6.0.3.1

The following simple commands should download the Wavemetrics homepage and save it bufferwave
(at least how I understand it)

variable sockNum = 0
make/t bufferwave
sockitopenconnection sockNum,"www.wavemetrics.com",80,bufferwave

As message I get back:
SOCKITmsg: Connected www.wavemetrics.com as socket number 244
which is o.k.,
but the bufferwave is empty and is only 1-dim, not as pointed out the help file "redimensioned to a two column, multi row wave.

After this Igor crashes with the following command:

sockitsendnrecv/TIME=2 sockNum,"GET / \r\n"

Debug informations are:
AppName: igor.exe AppVer: 6.0.3.1 ModName: sockit.xop
ModVer: 1.0.2.0 Offset: 00007b50

#1

Assigned to:Igor Pro User» andyfaff

Hi Peter, I've recompiled the program, it seems to work on my machine at the moment, can you try it on yours?

cheers,
Andy

#2

Status:active» fixed

Recompiled the XOP. Changed a logical test on the output of select(), if res > 0 then the select() succeeded. This seems to have solved the problem. Wasn't a problem with the Mac version.

#3

Status:fixed» active

Hi Andy,

thank you very much for taking care about the SOCKIT project.
As it still not works for me, I attached an Igor file containing a testcase.
Please let me know, if it works for you, or if I misunderstood some functionality of SOCKIT.
This time my test system was a Mac Intel, MAC OSX 10.4.11, and Igor 6.03A2.

Cheers
Peter

AttachmentSize
SockitTestcase.pxp55.69 KB

#4

Hi Peter,
the pxp file you attached did not have the SOCKITtestcase.ipf file embedded in it. Can you attach that file as well please? (or adopt it into the experiment File-->Adopt Procedure)
cheers,
Andy

#5

Hi Andy
Here comes the ipf file
Cheers
Peter

AttachmentSize
SockitTestCase.ipf767 bytes

#6

Hi Andy,
here comes the Igor Experiment fincluding the procedure and the notebook with the testcase description.
Cheers
Peter

AttachmentSize
SockitTestcase_0.pxp59.62 KB

#7

Category:bug report» support request

Hi Peter,
I've checked out your code and things seem to be working well.
The first comment I have is that the bufferwave doesn't change until the first message is received from the server socket. Thus, when you first make a connection, if the other side doesn't send any data then the wave isn't redimensioned, nor is it filled.

• TestCase1a()
SOCKITmsg: Connected www.example.com as socket number 51
0

This is your result from testcase1a(), SOCKIT has connected to the webserver (with socket descriptor 51) and your code prints (V_flag=)0, which indicates that the connection succeeded.

• TestCase2()
SOCKITmsg: wrote to socket 51

0
SOCKIT err: socket descriptor 51, disconnection???

With testcase2() you sent the "GET / \r\n" string, which made the webserver return the webpage. It was printed out to the history window (I can't see the bufferwave in the experiment file). The line at the end then says that socket 51 is disconnected. This happens because under the HTTP protocol once the request has been sent the server side socket shuts down, SOCKIT detects that the remote socket has closed and shuts down the socket that you created.

Thus, when you call testcase3a() there is no socket to close, it's already been closed, because the other end closed.

If you tried the SOCKIT out on a different protocol, then the IGOR socket won't shut down until the other side does (or you close it yourself).

I tried out your code on Windows and on MacOSX, both of them worked and gave the same output. Neither of them crashed IGOR. I used the versions currently available on the website.

Since I believe its not a bug, I've changed the category to support request.

Andy

#8

Hi Andy,

thank you very much for your help and support.
I think, now I start to understand the functionality of SOCKIT.
I could find the http-code in the bufferwave. It's appended to the end of the wave.

I started to implement a simple TCP-Server in my Labview application for sending data to Igor.
Till now, it works very good.

Best wishes
Peter

#9

Hi Peter,
in your quest for Labview->IGOR comms, don't forget that you can register a processor function for the socket. These take the form:

Function processorfunc(w,x)
Wave/t w     //will be the buffer wave
variable x    //will be the entry in the buffer wave
 
//do something with the received message
print w[x][0]  
End

This function is called whenever a message is received by the socket. Thus you can respond immediately to any events.

#10

Status:active» closed

Back to top