login about faq

We use chilkat (c# .net 4.0, chilkat version: 9.5.0.52) for our threaded tcp server. After a random time after the connection to a external server chilkat interrupts the connection with the error

Not connected: no internal socket object

This is our connection to the External server:

Socket asteriskSocket = new Socket();
success = asteriskSocket.UnlockComponent(Properties.Settings.Default.ChilkatSocketKey);
asteriskSocket.Connect(address, port, false, 60000);
asteriskSocket.MaxReadIdleMs = 500;
asteriskSocket.MaxSendIdleMs = 500;

while (asteriskSocket.IsConnected)
{
    receivedBytes = asteriskSocket.ReceiveBytes();
    //And plenty of other stuff in severall threads that do not access the socket anymore
}

The main socket connects to an asterisk server and on random occasions and after a random time chilkat loses the connection. We can not reproduce or force this issue. The external server has a uptime of 99.9%, the error should be on our side.

What does the error from chilkat mean? I could not find it in the documentation.

asked Aug 09 at 06:57

hartmann's gravatar image

hartmann
1


It seems to be the same problem on the server side.

My server inexplicably crashes after a random time. The acceptconnection loop is in a thread of a win32/plain C application.

DWORD dwThreadId ;

hThreadSocketChilkatC = CreateThread (NULL, 0, ThreadSocketChilkatC, (LPVOID)&numport, 0, &dwThreadId) ;

while (1)
    { if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
      { if (msg.message == WM_QUIT)
          break ;
        TranslateMessage(&msg) ;
        DispatchMessage(&msg) ;
    }
    else
        Sleep (1) ; // important !!!

And the thread is like that :

DWORD WINAPI ThreadSocketChilkatC(LPVOID lpParam)
{ 
  HCkSocket listenSocket;
  HCkSocket clientSocket;
  HCkTask task;

....

if (!CkSocket_UnlockComponent(listenSocket,"mycode....")) 
     goto label_endloop ;

if (!CkSocket_BindAndListen(listenSocket,5001,32)) 
    goto label_endloop ;

label_startloop :

if (byChilkat == 2) // NOT BLOCKING
  {
    task = CkSocket_AcceptNextConnectionAsync(listenSocket,0);
    if (CkSocket_getLastMethodSuccess(listenSocket) != TRUE) 
    {   ShowError ("Error CkSocket_AcceptNextConnectionAsync :", (char *)CkSocket_lastErrorText(listenSocket), FALSE) ;
        goto label_startloop ;
    }

if (!CkTask_Run(task)) 
        {    ShowError ("Error CkTask_Run (CkSocket_AcceptNextConnectionAsync) :", (char *)CkSocket_lastErrorText(listenSocket), FALSE) ;
            CkTask_Dispose(task);
            goto label_startloop ;
        }

while (CkTask_getFinished(task) != TRUE) 
            CkTask_SleepMs(task,10);    //  Sleep 10 ms.

status = CkTask_getStatusInt(task) ;
        if (status != 7) 
        {    ShowError ("Task (CkSocket_AcceptNextConnectionAsync) did not complete. Task status: ", (char *)CkTask_status(task), FALSE) ;
            CkTask_Dispose(task);
            goto label_startloop ;
        }

clientSocket = CkSocket_Create();
        if (!CkSocket_LoadTaskResult(clientSocket, task)) 
        {    ShowError ("CkSocket_LoadTaskResult", (char *)CkSocket_lastErrorText(clientSocket), FALSE) ;
            CkTask_Dispose(task);
            goto label_startloop ;
        }

CkTask_Dispose(task);
    }
    else    // BLOCKING
    {
         clientSocket = CkSocket_AcceptNextConnection(listenSocket, 0);
    }

hThreadSocketChilkatC = CreateThread(NULL, 0, ThreadSocketQuestionResponse, (LPVOID)&clientSocket, 0, &dwThreadId);

goto label_startloop ;

label_endloop :
...
}

see : http://www.chilkatforum.com/questions/10948/whats-wrong-with-this-acceptnextconnection-loop

I've been working on this problem for three monthes without explanation... :-((

link

answered Aug 15 at 07:55

billbaxter's gravatar image

billbaxter
(suspended)

edited Aug 15 at 08:09

Have you tried with the 9.5.0.58 chilkat version ?

That's what I'm going to do on my side.

link

answered Aug 16 at 05:07

billbaxter's gravatar image

billbaxter
(suspended)

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×60
×33
×31

Asked: Aug 09 at 06:57

Seen: 487 times

Last updated: Aug 16 at 05:07

powered by OSQA