I'm working on this client program in C, but it can never connect to the server. The Server is coded in C as well, but it is in UNIX, this is for my work. Basically they want me to code the client program in Windows so they can have a windows version running, however, I can never get it to get authorization from the server. The part where it rejects me is below

Code:

Code:
// server.c in UNIX

 /* The client makes a simple identification */ 
                if(fgets(line,MAXLINE,fdr) == NULL) goto finish; 
                /*if(sscanf(line,"%s %s %s",who,passwd,version) != 3) goto finish;*/ 
                strcpy(interface, "stpc"); 
                if(sscanf(line, "%s %s %s %s",who,passwd,version,interface) < 3) goto finish; 
                // this printf ensures that line has an interface 
                // for the logs 
                sprintf(line, "%s %s %s %s\n",who,passwd,version,interface); 
                if(strcmp(passwd,PASSWD) != 0) goto finish; 
                fprintf(stplog," %s %s %s",timestamp(),whoami,line); 
                fflush(stplog);  
  
                /* Let the client know we are connected */ 
                fprintf(fdw,"CONNECTED\n");  
                fflush(fdw);  


that was the server portion, and now below is the one I am trying to code, which is in windows.
Code:
Code:
// client.c in windows  

  fd_rd = _open_osfhandle(ws_sockfd, 0);

        if (fd_rd == -1) exit(-1);


	    ws_fdr= fdopen(fd_rd,"r"); 
	
	    ws_fdw= fdopen(fd_rd,"w");
		
   
	  

	  if( ws_fdr == NULL || ws_fdw == NULL)
	    err(FATAL,"STP: cannot open ws_fdw/ws_fdr\n");
	  
	  /* send authorization */
	 
      printf("Sending authorization!\n");
	  sprintf(line,"%s %s %s %s\n","STP",PASSWD,VERSION,"stpc"); // sets line to the ip, password, version, and interface
	 
	  ws_putline(line);
	  fflush(ws_fdw);
	  printf("Authorization sent, awaiting confirmation!\n");
	  
	  /* get connection acknowledgement */

	  /*

		Below is where we get our
		Connection failures


      */
	  ws_getline(line,MAXLINE);
	  if(strcmp(line,"CONNECTED\n") != 0) {
	    err(WARN,"STP: Connection rejected by waveserver - %s\n", line);
	    continue;
	  }



int ws_getline(char *str, int maxlen)
   {
	char *p, *fgets();
	p= fgets(str,maxlen,ws_fdr);
	if(p == NULL) return(EOF);
	return(strlen(p));
   }


void ws_putline(char *str)
   {
	fwrite(str,1,strlen(str),ws_fdw);
	fflush(ws_fdw);
   }
Basically it's trying to send the server the info, which are the password, version, interface and STP. and then the server should verify it and then say OK, and copy "CONNECTED\n" into line, and the we should be connected. On UNIX, both the client program and Server work fine. Please help, thanks.