Ignore:
Timestamp:
12/31/12 14:17:32 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Added the implementation of the local sockets for Win32 and it seems to work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/xplcommon/posix/LocalClientSocket.cc

    r15 r21  
    3232#include "LocalClientSocket.h"
    3333
    34 #include "Connector.h"
     34#include "LocalConnector.h"
    3535#include "LocalServerSocket.h"
    3636
     
    4040
    4141using xplcommon::posix::LocalClientSocket;
    42 using xplcommon::posix::Connector;
    43 
    44 //------------------------------------------------------------------------------
    45 
    46 /**
    47  * The connector class used by the local client.
    48  */
    49 class LocalClientSocket::LocalConnector : public Connector
    50 {
    51 private:
    52     /**
    53      * The reference to the corresponding socket's address.
    54      */
    55     const struct sockaddr_un& address;
    56 
    57 public:
    58     /**
    59      * Create the connector for the given local client socket.
    60      */
    61     LocalConnector(LocalClientSocket* socket);
    62 
    63 protected:
    64     /**
    65      * Get the address.
    66      */
    67     virtual const struct sockaddr* getAddress(size_t& addrlen);
    68 };
    69 
    70 //------------------------------------------------------------------------------
    71 
    72 inline
    73 LocalClientSocket::LocalConnector::LocalConnector(LocalClientSocket* socket) :
    74     Connector(socket),
    75     address(socket->sun)
    76 {
    77 }
    78 
    79 //------------------------------------------------------------------------------
    80 
    81 const struct sockaddr*
    82 LocalClientSocket::LocalConnector::getAddress(size_t& addrlen)
    83 {
    84     addrlen = sizeof(address);
    85     return reinterpret_cast<const struct sockaddr*>(&address);
    86 }
    8742
    8843//------------------------------------------------------------------------------
     
    9247                                     size_t readingCapacity,
    9348                                     size_t writingCapacity) :
    94     ClientSocket(AF_UNIX, SOCK_STREAM, waiter, 0,
    95                  readingCapacity, writingCapacity)
     49    ClientSocket(AF_UNIX, SOCK_STREAM, connector, waiter, 0,
     50                 readingCapacity, writingCapacity),
     51    connector(this, name)
    9652{
    97     sun.sun_family = AF_UNIX;
    98     LocalServerSocket::setupPath(sun, name);
    99 }
    100 
    101 //------------------------------------------------------------------------------
    102 
    103 Connector* LocalClientSocket::createConnector()
    104 {
    105     return new LocalConnector(this);
    10653}
    10754
Note: See TracChangeset for help on using the changeset viewer.