From bdf4adcfb3fe40dc16f8dadde4da416cc8a5b8d2 Mon Sep 17 00:00:00 2001 From: chatty Date: Tue, 10 May 1994 09:51:33 +0000 Subject: Removed useless default constructor replaced TRUE/FALSE by true/false --- comm/Datagram.cc | 36 ++++++++++++++++++++---------------- comm/Datagram.h | 8 ++++---- 2 files changed, 24 insertions(+), 20 deletions(-) (limited to 'comm') diff --git a/comm/Datagram.cc b/comm/Datagram.cc index b88deb5..d40de4b 100644 --- a/comm/Datagram.cc +++ b/comm/Datagram.cc @@ -17,30 +17,34 @@ #include #include +#ifdef __osf__ +extern "C" { + int sendto (int, char*, int, int,struct sockaddr*, int); + int recvfrom (int, char*, int, int,struct sockaddr*, int*); +} +#endif + /*?class UchDatagram A datagram socket can send to and receive from any other datagram socket, unless it is connected. Thus, establishing a datagram connection is simple. -UchDatagram sockets are not reliable: messages can be lost, duplicated, or be received in a different order. -They keep the message boundaries: when \var{n} bytes are written, you will read at most \var{n} bytes; -but if you ask to read less than \var{n} bytes, then the end of the message will be lost. +Datagram sockets are not reliable: messages can be lost, duplicated, +or be received in a different order. They keep the message +boundaries: when \var{n} bytes are written, you will read at most +\var{n} bytes; but if you ask to read less than \var{n} bytes, then +the end of the message will be lost. -When a datagram socket is not connected, you must provide an address when you send a message; -when a message is read, the address of the sender can be retrieved (with function \fun{From}). -When a datagram socket is connected, messages can only be sent to and read from the -connected address. The \fun{Read} and \fun{Write} calls can be used in this case. +When a datagram socket is not connected, you must provide an address +when you send a message; when a message is read, the address of the +sender can be retrieved (with function \fun{From}). When a datagram +socket is connected, messages can only be sent to and read from the +connected address. The \fun{Read} and \fun{Write} calls can be used in +this case. Before any data can be sent or received, the socket must be set up with \fun{Setup}. ?*/ -/*?nextdoc?*/ -UchDatagram :: UchDatagram () -: UchSocket (), - FAddr (0) -{ -} - /*? These constructors are similar to those of the class \typ{UchSocket}. ?*/ @@ -110,7 +114,7 @@ UchDatagram :: Receive (byte* buf, int len) int alen = sizeof (addr); int ret; - ret = recvfrom (FilDes (), (char*) buf, len, 0, &addr.sa, &alen); + ret = recvfrom (Fd, (char*) buf, len, 0, &addr.sa, &alen); if (ret < 0) return ret; @@ -153,7 +157,7 @@ UchDatagram :: Receive (UchMsgBuffer& buf) /*? The same functions but with a \typ{UchMsgBuffer} argument instead of a byte pointer and size. -As usual, if \var{peek} is TRUE the buffer is not flushed. +As usual, if \var{peek} is true the buffer is not flushed. ?*/ int UchDatagram :: Reply (UchMsgBuffer& buf, bool peek) diff --git a/comm/Datagram.h b/comm/Datagram.h index 3ac6b36..954f1e2 100644 --- a/comm/Datagram.h +++ b/comm/Datagram.h @@ -21,9 +21,9 @@ class UchDatagram : public UchSocket { protected: pUchAddress FAddr; + public: - UchDatagram (); - UchDatagram (UchAddress*, UchAddress*); + UchDatagram (UchAddress* = 0, UchAddress* = 0); ~UchDatagram (); UchDatagram (const UchDatagram& d); UchChannel* Copy () const; @@ -32,9 +32,9 @@ public: int Receive (byte*, int); inline UchAddress* From () { return FAddr; } int Reply (byte*, int); - int Send (UchMsgBuffer& b, UchAddress& a, bool = FALSE); + int Send (UchMsgBuffer& b, UchAddress& a, bool = false); int Receive (UchMsgBuffer& b); - int Reply (UchMsgBuffer& b, bool = FALSE); + int Reply (UchMsgBuffer& b, bool = false); }; #endif /* Datagram_H_ */ -- cgit v1.1