- Additional bug fixes related to network connection code for win32

- print out socket errors to console instead of throw exceptions
This commit is contained in:
Mark Vejvoda
2010-02-21 03:48:05 +00:00
parent 0d53988e99
commit 7657b40a4b
5 changed files with 927 additions and 775 deletions

View File

@@ -235,9 +235,9 @@ int Socket::getDataToRead(){
if(err < 0 && errno != EAGAIN)
{
char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s] ERROR PEEKING SOCKET DATA, err = %d errno = %d [%s]",__FILE__,__FUNCTION__,err,errno,strerror(errno));
throwException(szBuf);
sprintf(szBuf,"In [%s::%s] ERROR PEEKING SOCKET DATA, err = %d errno = %d [%s]\n",__FILE__,__FUNCTION__,err,errno,strerror(errno));
//throwException(szBuf);
printf("%s",szBuf);
}
else if(err == 0)
{
@@ -257,9 +257,9 @@ int Socket::send(const void *data, int dataSize) {
if(bytesSent < 0 && errno != EAGAIN)
{
char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s] ERROR WRITING SOCKET DATA, err = %d errno = %d [%s]",__FILE__,__FUNCTION__,bytesSent,errno,strerror(errno));
throwException(szBuf);
sprintf(szBuf,"In [%s::%s] ERROR WRITING SOCKET DATA, err = %d errno = %d [%s]\n",__FILE__,__FUNCTION__,bytesSent,errno,strerror(errno));
//throwException(szBuf);
printf("%s",szBuf);
}
else if(bytesSent < 0 && errno == EAGAIN)
{
@@ -304,8 +304,8 @@ int Socket::receive(void *data, int dataSize)
{
char szBuf[1024]="";
sprintf(szBuf,"[%s::%s] ERROR READING SOCKET DATA error while sending socket data, bytesSent = %d, errno = %d [%s]\n",__FILE__,__FUNCTION__,bytesReceived,errno,strerror(errno));
throwException(szBuf);
//throwException(szBuf);
printf("%s",szBuf);
}
else if(bytesReceived < 0 && errno == EAGAIN)
{
@@ -346,8 +346,9 @@ int Socket::peek(void *data, int dataSize){
{
char szBuf[1024]="";
sprintf(szBuf,"[%s::%s] ERROR PEEKING SOCKET DATA error while sending socket data, bytesSent = %d, errno = %d [%s]\n",__FILE__,__FUNCTION__,err,errno,strerror(errno));
//throwException(szBuf);
throwException(szBuf);
disconnectSocket();
}
else if(err < 0 && errno == EAGAIN)
{

View File

@@ -454,6 +454,8 @@ void exceptionMessage(const exception &excp){
message+= excp.what();
title= "Error: Unhandled Exception";
printf("Error detected with text: %s\n",message.c_str());
MessageBox(NULL, message.c_str(), title.c_str(), MB_ICONSTOP | MB_OK | MB_TASKMODAL);
}

File diff suppressed because it is too large Load Diff