[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Socket with g++

Hi folks:

   I was trying to compile a simple server program using
socket in g++ and I got the following error message:

   type `sockaddr' is not a base type for type `sockaddr_in'

   The code fragments related with this error are:
  int socket_descriptor; // socket declaration


  struct sockaddr_in sa, isa; // Internet socket addr. structure

  if (bind(socket_descriptor, (struct sockaddr *) &sa, sizeof(sa)) < 0)


  // the error message reports to this line:
  if((socket_descriptor=accept(socket_descriptor, &isa, &i)) < 0){

   May anyone tell me what can be wrong? Is there another way of using
sockets in C++ ? 
   Thanks in advance. 

Ivan J. Varzinczak - (mailto: ivan@inf.ufpr.br)
Bolsista PET/CAPES - Depto. de Informatica - UFPR
Curitiba - Parana - Brasil
Phone: +55 (041) 347-3240 - 267-5244 r.315


Reply to: