void mySocket::setSocketBlocking(int blockingToggle)
{
    if (blockingToggle)
    {
        if (getSocketBlocking()) return;
        else blocking = 1;
	}
	else
	{
		if (!getSocketBlocking()) return;
		else blocking = 0;
	}

	try 
	{
		#ifdef WINDOWS_XP
			if (ioctlsocket(socketId,FIONBIO,(unsigned long *)blocking) == -1)
			{
				int errorCode;
				string errorMsg = "Blocking option: ";
				detectErrorSetSocketOption(&errorCode,errorMsg);
				myException* socketOptionException = new myException(errorCode,errorMsg);
				throw socketOptionException;
			}
		#endif

		#ifdef UNIX
			if (ioctl(socketId,FIONBIO,(char *)&blocking) == -1)
			{
				myException* unixSocketOptionException = new myException(0,"unix: error getting host by name");
				throw unixSocketOptionException;
			}
		#endif
	}
    catch(myException* excp)
	{
		excp->response();
		delete excp;
		exit(1);
	}
}
void MySocket::setSocketBlocking(int blockingToggle)
{
    if (blockingToggle)
    {
        if (getSocketBlocking()) return;
        else m_nBlocking = 1;
	}
	else
	{
		if (!getSocketBlocking()) return;
		else m_nBlocking = 0;
	}

	try 
	{
		#ifdef WINDOWS_XP
			if (ioctlsocket(m_nSocketId,FIONBIO,(unsigned long *)&m_nBlocking) == -1)
			{
				int errorCode;
				string errorMsg = "Blocking option: ";
				detectErrorSetSocketOption(&errorCode,errorMsg);
				MyException socketOptionException(errorCode,errorMsg);
				throw socketOptionException;
			}
		#endif

		#ifdef UNIX
			if (ioctl(m_nSocketId,FIONBIO,(char *)&m_nBlocking) == -1)
			{
				MyException unixSocketOptionException(0,"unix: error getting host by name");
				throw unixSocketOptionException;
			}
		#endif
	}
    catch(MyException& excp)
	{
		excp.response();
		exit(1);
	}
}