[
https://issues.apache.org/jira/browse/AXIS2C-1109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12590747#action_12590747
]
Manjula Peiris commented on AXIS2C-1109:
----------------------------------------
Following are the steps to create a patch.
1. Get a fresh check out from the trunk.
2. Do the changes you are suggesting to the file or files.
3. Issue the following command from the directory you did the changes.
svn diff > patch
4. Attach the patch in the JIRA.
> axutil_network_handler_open_socket incorrectly assumes that all legal
> descriptors are >=0
> -----------------------------------------------------------------------------------------
>
> Key: AXIS2C-1109
> URL: https://issues.apache.org/jira/browse/AXIS2C-1109
> Project: Axis2-C
> Issue Type: Bug
> Affects Versions: 1.3.0
> Environment: windows xp, VS.2005
> Reporter: Pim Philipse
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> The line
> if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
> does not work as expected under Windows, since winsock socket() returns
> INVALID_SOCKET on error, which happens to be 0.
> As a result, the next call to winsock fails, which is most confusing when
> trying to resolve a problem.
> Additionally, the error reporting is very terse. I have added a diagnostic
> function that gives the specific error (under windows):
> #define ERRBUFSIZE 300
> void
> get_socket_error(char *buf)
> {
> LPVOID lpMsgBuf;
> int rc = WSAGetLastError();
> sprintf( buf, "Winsock error %d: ", rc );
> FormatMessage(
> FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
> NULL,
> rc,
> MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
> (LPTSTR) &lpMsgBuf,
> 0,
> NULL
> );
> strncat( buf, (char*)lpMsgBuf, ERRBUFSIZE - strlen( buf ) - 1 );
> LocalFree( lpMsgBuf );
> }
> and then the error handling is invoked as, f.e.:
> if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == AXIS2_INVALID_SOCKET)
> /*nnn AF_INET is not defined in sys/socket.h but PF_INET*/
> {
> char buf[ERRBUFSIZE];
> AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SOCKET_ERROR, AXIS2_FAILURE);
> get_socket_error(buf);
> AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, buf);
> return AXIS2_INVALID_SOCKET;
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]