diff options
author | Bert Belder <bertbelder@gmail.com> | 2010-11-25 01:21:30 +0100 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2010-12-20 23:50:39 +0100 |
commit | a85a77626846894aa5f5119ac9a35b6d2c9ec5c4 (patch) | |
tree | e6eb41bfe3f07298ca656d3ccc44b677124cefb4 /src/node_net.cc | |
parent | 7a1917d86fc5fa377a64317a37ab57cf3382b4b3 (diff) | |
download | node-new-a85a77626846894aa5f5119ac9a35b6d2c9ec5c4.tar.gz |
Most of node_net is not yet available on windows
Diffstat (limited to 'src/node_net.cc')
-rw-r--r-- | src/node_net.cc | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/node_net.cc b/src/node_net.cc index a86e2bb668..6edf4ee6de 100644 --- a/src/node_net.cc +++ b/src/node_net.cc @@ -68,10 +68,15 @@ static Persistent<FunctionTemplate> recv_msg_template; String::New("Bad file descriptor argument"))); \ } + +#ifdef __POSIX__ + static inline bool SetCloseOnExec(int fd) { return (fcntl(fd, F_SETFD, FD_CLOEXEC) != -1); } +#endif // __POSIX__ + static inline bool SetNonBlock(int fd) { #ifdef __MINGW32__ @@ -96,6 +101,8 @@ static inline bool SetSockFlags(int fd) { } +#ifdef __POSIX__ + // Creates nonblocking pipe static Handle<Value> Pipe(const Arguments& args) { HandleScope scope; @@ -116,7 +123,6 @@ static Handle<Value> Pipe(const Arguments& args) { return scope.Close(a); } - // Creates nonblocking socket pair static Handle<Value> SocketPair(const Arguments& args) { HandleScope scope; @@ -311,6 +317,8 @@ static Handle<Value> Bind(const Arguments& args) { return Undefined(); } +#endif // __POSIX__ + static Handle<Value> Close(const Arguments& args) { HandleScope scope; @@ -325,6 +333,8 @@ static Handle<Value> Close(const Arguments& args) { } +#ifdef __POSIX__ + // t.shutdown(fd, "read"); -- SHUT_RD // t.shutdown(fd, "write"); -- SHUT_WR // t.shutdown(fd, "readwrite"); -- SHUT_RDWR @@ -535,6 +545,8 @@ static Handle<Value> SocketError(const Arguments& args) { return scope.Close(Integer::New(error)); } +#endif // __POSIX__ + // var bytesRead = t.read(fd, buffer, offset, length); // returns null on EAGAIN or EINTR, raises an exception on all other errors @@ -580,6 +592,8 @@ static Handle<Value> Read(const Arguments& args) { return scope.Close(Integer::New(bytes_read)); } +#ifdef __POSIX__ + // var info = t.recvfrom(fd, buffer, offset, length, flags); // info.size // bytes read // info.port // from port @@ -736,6 +750,8 @@ static Handle<Value> RecvMsg(const Arguments& args) { return scope.Close(Integer::New(bytes_read)); } +#endif // __POSIX__ + // var bytesWritten = t.write(fd, buffer, offset, length); // returns null on EAGAIN or EINTR, raises an exception on all other errors @@ -783,6 +799,8 @@ static Handle<Value> Write(const Arguments& args) { } +#ifdef __POSIX__ + // var bytes = sendmsg(fd, buf, off, len, fd, flags); // // Write a buffer with optional offset and length to the given file @@ -1301,6 +1319,8 @@ static Handle<Value> CreateErrnoException(const Arguments& args) { return scope.Close(exception); } +#endif // __POSIX__ + void InitNet(Handle<Object> target) { HandleScope scope; @@ -1308,6 +1328,7 @@ void InitNet(Handle<Object> target) { NODE_SET_METHOD(target, "write", Write); NODE_SET_METHOD(target, "read", Read); +#ifdef __POSIX__ NODE_SET_METHOD(target, "sendMsg", SendMsg); NODE_SET_METHOD(target, "recvfrom", RecvFrom); NODE_SET_METHOD(target, "sendto", SendTo); @@ -1317,7 +1338,11 @@ void InitNet(Handle<Object> target) { target->Set(String::NewSymbol("recvMsg"), recv_msg_template->GetFunction()); NODE_SET_METHOD(target, "socket", Socket); +#endif //__POSIX__ + NODE_SET_METHOD(target, "close", Close); + +#ifdef __POSIX__ NODE_SET_METHOD(target, "shutdown", Shutdown); NODE_SET_METHOD(target, "pipe", Pipe); NODE_SET_METHOD(target, "socketpair", SocketPair); @@ -1337,6 +1362,7 @@ void InitNet(Handle<Object> target) { NODE_SET_METHOD(target, "getaddrinfo", GetAddrInfo); NODE_SET_METHOD(target, "isIP", IsIP); NODE_SET_METHOD(target, "errnoException", CreateErrnoException); +#endif // __POSIX__ errno_symbol = NODE_PSYMBOL("errno"); syscall_symbol = NODE_PSYMBOL("syscall"); |