Create() method is not creating socket consistently, while it works 1 or 2 times from ASP...

  • Thread starter Thread starter S.P Singh
  • Start date Start date
S

S.P Singh

Guest
Priority: - High





Dll Created In: - MFC VC 6.0

Application Developed In: - VC 6.0, ASP .Net (ASP .Net application using MFC Dlls)

OS: - Windows Server 2008 64 bit

Development IDE: - Visual Studio 2008



.

Problem: - Facing problem in creating socket in a method from an already deployed application exe while same method is working from another exe from same environment from same location.

.

Problem Persistent : - Only 1 or 2 times application works fine after that it consistently throw error code.

.


Description: - We have asp .Net project in which, we call a method from dll, developed in MFC VC6.0. In the dll we have a method which downloads images from another system after making socket connection. But every time we are getting Error code 7, it is not giving desire result while same method is working from another asp .Net application from same environment other machine from other location

.

Already Attempt: - Because error is coming on client side so we have created a driver in C# which invokes same method from same environment (on client machine) using same dll and we are astonished because it worked fine there.

.

Kindly Suggest: - We are not able to figure out root cause because nothing is coming in windows event logs but what I did, for finding the problem line, I wrote logs on each line and found the exact line in dll code, which is not working, actually it is not executing Create () method, I will give snippet of the code for understanding the problem because we are not finding any kind of solution for it. Kindly assist us in understanding and fixing this problem.

.

Code Snippet: -

Int Initialize (LPTSTR SiteAddress, short PortId)

{

try

{

CClientTSSocket *m_pJtsSockto;

m_pJtsSockto = new CClientTSSocket;

LONG lErr = m_pJtsSockto->ConnectTS(csIPAddress,PortId);

ErrorLog (0, 0, "--------ConnectTS has been called ------------","" );

}

catch(...)

{

DWORD errorCode = GetLastError();

CString errorMessage ;

errorMessage.Format("%lu",errorCode);

ErrorLog (0, 0, "Image System", (LPTSTR)(LPCTSTR)errorMessage);



return IS_ERR_WINDOWS;

}

}

Note: - CClientTSSocket extends CAsyncSocket

IS_ERR_WINDOWS is a macro error code which value is 7.

.

LONG ConnectTS(CString strIP, UINT n_Port)

{

ErrorLog(0,0,"ConnectTS is calling Create [is going to call]","");

if(!Create())

{

ErrorLog(0,0,"ConnectTS is calling [Create not called successfully] ","");

n_Err = GetLastError();

ErrorLog(n_Err,0,"ConnectTS is calling1111111111111111Erorrrrrrrrrrrrr","");

return NET_INIT;

}

ErrorLog(0,0,"ConnectTS is calling2222222222222222222","");

if(!AsyncSelect(0))

{

n_Err = GetLastError();

return NET_INIT;

}

if(!Connect(strIP,n_Port))

{



n_Err = GetLastError();

ErrorLog(n_Err,0,"ConnectTS","");

return SERVER_NOT_CONNECTED;

}

}

.



Code description: - From int GETImage_MT() method, we call Initialize() method and pass client machine IP and Port and there we call ConnectTS() method, In this method we Create() method and finally it returns the error code as mention in macro 7.

.

Logs after running the program: -

--------ConnectTS has been called ------------

ConnectTS is calling Create [is going to call]

Image System 0

.

Note: - According to logs, problem is coming in Create method(). Here 0 is errorMessage received in catch block. And from catch block it returns macro value 7. And when we run same method individually from same machine, same environment through same dll from different exe, it is working fine and we are not facing any kind of problem.



While same problem application was working properly earlier but now continuously it showing problem.

.

Kindly assist us to resolve the issue.

Continue reading...
 
Back
Top