Ignore:
Timestamp:
Aug 2, 2007, 7:43:29 PM (14 years ago)
Author:
charles
Message:

win32 cleanly compiles and starts now. (still doesn't atually *work*, but we're getting closer...)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/net.c

    r2578 r2591  
    2929
    3030#include <sys/types.h>
     31
     32#ifndef WIN32
    3133#include <netdb.h>
    3234#include <fcntl.h>
     35#endif
    3336
    3437#include "transmission.h"
     
    3841#include "utils.h"
    3942
     43
     44void
     45tr_netInit( void )
     46{
     47    static int initialized = FALSE;
     48    if( !initialized )
     49    {
     50#ifdef WIN32
     51        WSADATA wsaData;
     52        WSAStartup(MAKEWORD(2,2), &wsaData);
     53#endif
     54        initialized = TRUE;
     55    }
     56}
    4057
    4158/***********************************************************************
     
    241258static int makeSocketNonBlocking( int s )
    242259{
    243 #ifdef SYS_WIN32
     260#ifdef WIN32
    244261    unsigned long flags = 1;
    245     if( ioctlsocket( sock, FIONBIO, &flags) == SOCKET_ERROR )
     262    if( ioctlsocket( s, FIONBIO, &flags) == SOCKET_ERROR )
    246263#elif defined(SYS_BEOS)
    247264    int flags = 1;
     
    255272    {
    256273        tr_err( "Could not set socket to non-blocking mode (%s)",
    257                 strerror( errno ) );
     274                strerror( sockerrno ) );
    258275        tr_netClose( s );
    259276        return -1;
     
    294311        sockerrno != EINPROGRESS )
    295312    {
    296         tr_err( "Could not connect socket (%s)", strerror( errno ) );
     313        tr_err( "Could not connect socket (%s)", strerror( sockerrno ) );
    297314        tr_netClose( s );
    298315        return -1;
     
    329346    req.imr_multiaddr.s_addr = addr->s_addr;
    330347    req.imr_interface.s_addr = htonl( INADDR_ANY );
    331     if( setsockopt( fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &req, sizeof ( req ) ) )
    332     {
    333         tr_err( "Could not join multicast group (%s)", strerror( errno ) );
     348    if( setsockopt( fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char*)&req, sizeof ( req ) ) )
     349    {
     350        tr_err( "Could not join multicast group (%s)", strerror( sockerrno ) );
    334351        tr_netClose( fd );
    335352        return -1;
     
    361378#ifdef SO_REUSEADDR
    362379    optval = 1;
    363     setsockopt( s, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof( optval ) );
     380    setsockopt( s, SOL_SOCKET, SO_REUSEADDR, (char*)&optval, sizeof( optval ) );
    364381#endif
    365382
Note: See TracChangeset for help on using the changeset viewer.