Results 1 to 3 of 3

Thread: Need this compiled properly.

  1. Wink Need this compiled properly.

    I have made this code to have my router ident with my nick in all situations - The code is fine - i just need it compiled for the Asus WL500G deluxe.

    Please someone do this for me.

    Code:
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <arpa/inet.h>
    #include <netdb.h>
    #include <stdio.h>
    #include <unistd.h> /* close */
    #include <signal.h>
    
    #define SUCCESS 0
    #define ERROR   1
    
    #define SERVER_PORT 113
    
    
    int sock;
    
    void dead (void) {
      printf("We died.\n");
      close(sock);
      exit(1);
    }
    
    int main (int argc, char *argv[]) {
      
      int sd, cliLen, i, pid;
      
      struct sockaddr_in cliAddr, servAddr;
      char buf[128];
      char request[32];
    
      fork();
    
      signal(SIGTERM,(void *)dead);
      signal(SIGINT, (void *)dead);
      signal(SIGSEGV,(void *)dead);
      signal(SIGALRM,(void *)dead);
    
      /* create socket */
      sd = socket(AF_INET, SOCK_STREAM, 0);
      if(sd<0) {
        perror("Cannot open socket");
        return ERROR;
      }
      
      /* bind server port */
      servAddr.sin_family = AF_INET;
      servAddr.sin_addr.s_addr = htonl(INADDR_ANY);
      servAddr.sin_port = htons(SERVER_PORT);
      
      if(bind(sd, (struct sockaddr *) &servAddr, sizeof(servAddr))<0) {
        perror("Cannot bind port");
        return ERROR;
      }
    
      listen(sd,5);
      
      while(1) {
    
        printf("%s: waiting for data on port TCP %u\n",argv[0],SERVER_PORT);
    
        cliLen = sizeof(cliAddr);
        sock = accept(sd, (struct sockaddr *) &cliAddr, &cliLen);
        if(sock<0) {
          perror("Cannot accept connection");
          return ERROR;
        }
        
        memset(buf,0x00,128);
        if(read(sock, buf, 30) == ERROR) {
          perror("Error reading from socket");
          return ERROR;
        }
    
        for (i=0;i<=30;i++)
          if (buf[i] == '\n' || buf[i] == '\r') {
    	buf[i] = '\0';
    	break;
          }
    
        printf("Received from %s: %s\n", inet_ntoa(cliAddr.sin_addr), buf);
        
        sprintf(buf,"%s%s", buf ," : USERID : UNIX : eonix\r\n");
        write(sock,buf,strlen(buf));
        close(sock); 
            
      } 
    
    }
    Hope you guys with the right compiling environment will help me out here.

    Thank you in advance

    EoniX

  2. #2
    Join Date
    Jul 2004
    Location
    near Lyon @ France
    Posts
    195

    Give it a try

    I think you should install your own env, using coolinux, it's really easy.
    Anyway, here is your binary

    JF
    Attached Files Attached Files

  3. Thank you VERY much!

    Ill get back to making my own env later on - no time right now

    And btw - the ident works perfectly! - Thank you.

Similar Threads

  1. no /dev/discs on own compiled 1.9.2.7-4
    By Jean-Fabrice in forum WL-HDD Custom Development
    Replies: 13
    Last Post: 22-10-2006, 16:49
  2. Some packages I compiled
    By Jean-Fabrice in forum WL-500g Custom Development
    Replies: 7
    Last Post: 23-03-2005, 12:29
  3. Anyone have perl compiled for wh-hdd ?
    By ezhikov in forum WL-HDD Q&A
    Replies: 0
    Last Post: 08-02-2005, 10:22
  4. Replies: 0
    Last Post: 28-09-2004, 17:30

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •