// TcpSocket_p.cpp (c) 2011 Derek Barnett
// Marth Lab, Department of Biology, Boston College
// ---------------------------------------------------------------------------
-// Last modified: 8 December 2011 (DB)
+// Last modified: 5 January 2012 (DB)
// ---------------------------------------------------------------------------
// Provides basic TCP I/O interface
// ***************************************************************************
using namespace BamTools::Internal;
#include <algorithm>
+#include <climits>
#include <sstream>
#include <vector>
using namespace std;
namespace Internal {
// constants
-static const size_t DEFAULT_BUFFER_SIZE = 0x4000;
+static const size_t DEFAULT_BUFFER_SIZE = 0x10000;
} // namespace Internal
} // namespace BamTools
, m_engine(0)
, m_cachedSocketDescriptor(-1)
, m_readBuffer(DEFAULT_BUFFER_SIZE)
- , m_error(TcpSocket::UnknownSocketError)
+ , m_error(TcpSocket::NoError)
, m_state(TcpSocket::UnconnectedState)
{ }
m_hostName = hostInfo.HostName();
m_mode = mode;
m_state = TcpSocket::UnconnectedState;
- m_error = TcpSocket::UnknownSocketError;
+ m_error = TcpSocket::NoError;
// m_localPort = 0;
m_remotePort = 0;
// m_localAddress.Clear();
// prep result byte buffer
ByteArray result;
-
- size_t bufferMax = ((max > static_cast<int64_t>(string::npos)) ? string::npos : static_cast<size_t>(max));
+ size_t bufferMax = ((max > static_cast<int64_t>(UINT_MAX))
+ ? UINT_MAX : static_cast<size_t>(max));
result.Resize(bufferMax);
// read data
if ( result.Size() == 0 ) {
if ( bufferMax == 0 )
- bufferMax = string::npos;
+ bufferMax = UINT_MAX;
result.Resize(1);