1 #include "Handle_L_Pipe.h"
2 #include "ace/OS_NS_ctype.h"
3 #include "ace/OS_NS_unistd.h"
5 #if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
7 // Uppercase N bytes of S.
10 Handle_L_Pipe::upper_case (char s
[], int n
)
13 if (ACE_OS::ace_islower (s
[n
]))
14 s
[n
] = ACE_OS::ace_toupper (s
[n
]);
20 Handle_L_Pipe::handle_input (ACE_HANDLE
)
22 ACE_LSOCK_Stream new_local_stream
;
24 ACE_HANDLE fd1
= ACE_INVALID_HANDLE
;
25 ACE_HANDLE fd2
= ACE_INVALID_HANDLE
;
28 if (this->accept (new_local_stream
) == -1)
31 if (new_local_stream
.recv_handle (fd1
) == -1
32 || new_local_stream
.recv_handle (fd2
) == -1)
36 ACE_TEXT ("received file descriptors %d and %d\n"),
40 if ((n
= ACE_OS::read (fd1
, buf
, sizeof buf
)) == -1)
42 else if (ACE_OS::write (fd2
, this->upper_case (buf
, n
), n
) == -1)
44 if (ACE_OS::close (fd1
) == -1
45 || ACE_OS::close (fd2
) == -1)
47 if (new_local_stream
.close () == -1)
53 const ACE_TCHAR
*Handle_L_Pipe::DEFAULT_RENDEZVOUS
= ACE_TEXT ("/tmp/foo_pipe");
55 #if !defined (__ACE_INLINE__)
56 #include "Handle_L_Pipe.inl"
57 #endif /* __ACE_INLINE__ */
59 Handle_L_Pipe local_pipe
;
60 ACE_Service_Object_Type
lp (&local_pipe
, ACE_TEXT ("Local_Pipe"));
62 #endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */