Commit 6db6b01f authored by jan.koester's avatar jan.koester
Browse files

copy fixed

parent 1e5772bc
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -106,12 +106,12 @@ void netplus::socket::setTimeout(int sec){

void netplus::socket::copyAddrInfo(ULONG_PTR *dest, ULONG_PTR src){
    memcpy((void*)*(dest), (void*)src, sizeof(struct addrinfo));
        ((struct addrinfo*)*(struct addrinfo**)dest)->ai_addr=(struct sockaddr*)malloc(((struct addrinfo*)src)->ai_addrlen);
        memcpy((void*)((struct addrinfo*)*(struct addrinfo**)dest)->ai_addr,
    ((struct addrinfo*)*dest)->ai_addr = (struct sockaddr*)malloc(((struct addrinfo*)src)->ai_addrlen);
    memcpy((void*)((struct addrinfo*)*dest)->ai_addr,
        (void*)((struct addrinfo*)src)->ai_addr,
        ((struct addrinfo*)*(struct addrinfo**)dest)->ai_addrlen
    );
        ((struct addrinfo*)*(struct addrinfo**)dest)->ai_addrlen=((struct addrinfo*)src)->ai_addrlen;
    ((struct addrinfo*)*dest)->ai_addrlen = ((struct addrinfo*)src)->ai_addrlen;
}


+3 −3
Original line number Diff line number Diff line
@@ -87,10 +87,10 @@ SOCKET netplus::socket::fd() {

void netplus::socket::copyAddrInfo(ULONG_PTR *dest, ULONG_PTR src){
        memcpy((void*)*(dest),(void*)src,sizeof(struct addrinfo));
        ((struct addrinfo*)*(struct addrinfo**)dest)->ai_addr=(struct sockaddr*)malloc(((struct addrinfo*)src)->ai_addrlen);
        memcpy((void*)((struct addrinfo*)*(struct addrinfo**)dest)->ai_addr,
        ((struct addrinfo*)*dest)->ai_addr=(struct sockaddr*)malloc(((struct addrinfo*)src)->ai_addrlen);
        memcpy((void*)((struct addrinfo*)*dest)->ai_addr,
               (void*)((struct addrinfo*)src)->ai_addr,
               ((struct addrinfo*)*(struct addrinfo**)dest)->ai_addrlen
        );
        ((struct addrinfo*)*(struct addrinfo**)dest)->ai_addrlen=((struct addrinfo*)src)->ai_addrlen;
        ((struct addrinfo*)*dest)->ai_addrlen=((struct addrinfo*)src)->ai_addrlen;
}
+2 −2
Original line number Diff line number Diff line
@@ -222,9 +222,9 @@ void netplus::tcp::connect(socket *ssock){

    copyAddrInfo(&_SocketInfo,ssock->_SocketInfo);

    std::cout << ((struct addrinfo*)_SocketInfo)->ai_socktype << std::endl;
    std::cout << ((struct addrinfo*)ssock->_SocketInfo)->ai_addr << ": " << (int)((struct addrinfo*)ssock->_SocketInfo)->ai_addrlen << std::endl;

    if( (_Socket=::WSASocketW(((struct addrinfo*)_SocketInfo)->ai_family, ((struct addrinfo*)_SocketInfo)->ai_socktype,
    if( (_Socket=::WSASocket(((struct addrinfo*)_SocketInfo)->ai_family, ((struct addrinfo*)_SocketInfo)->ai_socktype,
        ((struct addrinfo*)_SocketInfo)->ai_protocol, nullptr, 0, WSA_FLAG_OVERLAPPED)) < 0 ){
        NetException exception;
        exception[NetException::Error] << "Create Socket " << (int) _Socket << " failed : " <<  GetLastError();
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ extern "C" {

netplus::udp::udp(const char* uxsocket, int maxconnections, int sockopts) : socket() {
    NetException exception;
    exception[NetException::Critical] << "tcp: Windows doesn't support UnixSockets !";
    exception[NetException::Critical] << "udp: Windows doesn't support UnixSockets !";
    throw exception;
}