| 262 | } |
| 263 | |
| 264 | PCASC_SOCKET CASC_SOCKET::New(PADDRINFO remoteList, PADDRINFO remoteItem, const char * hostName, unsigned portNum, HANDLE sock) |
| 265 | { |
| 266 | PCASC_SOCKET pSocket; |
| 267 | size_t length = strlen(hostName); |
| 268 | |
| 269 | // Allocate enough bytes |
| 270 | pSocket = (PCASC_SOCKET)CASC_ALLOC<BYTE>(sizeof(CASC_SOCKET) + length); |
| 271 | if(pSocket != NULL) |
| 272 | { |
| 273 | // Fill the entire object with zero |
| 274 | memset(pSocket, 0, sizeof(CASC_SOCKET) + length); |
| 275 | pSocket->remoteList = remoteList; |
| 276 | pSocket->remoteItem = remoteItem; |
| 277 | pSocket->dwRefCount = 1; |
| 278 | pSocket->portNum = portNum; |
| 279 | pSocket->sock = sock; |
| 280 | |
| 281 | // Init the remote host name |
| 282 | CascStrCopy((char *)pSocket->hostName, length + 1, hostName); |
| 283 | |
| 284 | // Init the socket lock |
| 285 | CascInitLock(pSocket->Lock); |
| 286 | } |
| 287 | |
| 288 | return pSocket; |
| 289 | } |
| 290 | |
| 291 | PCASC_SOCKET CASC_SOCKET::Connect(const char * hostName, unsigned portNum) |
| 292 | { |
no test coverage detected