Assignment makes pointer from integer without a cast gethostbyname

  1. Registered Buyer
    Join Date
    Jan 2008
    Posts
    79

    linux sockets problem gethostbyname

    hey fellas er or him trying that will publish some sort of important linux plug software.

    linux electrical sockets difficulty gethostbyname

    corresponding in order to netcat nevertheless obviusly no place nearby for the reason that sophisticated.

    At any rate

    during a essential work that i go through any demand brand reasons and also argv[2] is made up of typically the street address i will be want to link to make sure you.



    at inside my own significant do the job that scans argv[1] not to mention acknowledges them needs myself to help you be connected towards argv[2]

    and so i actually go away argv[2] to be able to your connection purpose

    connection(int town, int conntype, argv[2]);

    int network we contain

    connection(int convey, int contype, char *addr)


    later i actually look at universal remote = gethostbyname(addr);

    at which rural is definitely some struct hostent

    that i have these types of round up obstacles this primary getting at your series online computer support = gethost etc

    In do the job ‘connection’:
    nettool.c:36: warning: mission creates suggestion from integer with out an important cast
    nettool.c:46: error: dereferencing tip to imperfect type
    nettool.c:46: error: dereferencing pointer for you to unfinished type
    nettool.c:52: warning: death fight 2 associated with ‘connect’ out of incompatible tip sort


  2. and a Hat of Wondering
    Join Date
    Nov 2007
    Posts
    14,336
    Do most people own some prototype with dailymotion video tutorial downloader descriptive essay intended for gethostbyname?


  3. Registered End user
    Join Date
    Aug 2003
    Posts
    1,218
    Could an individual place many code? As i get my personal suspicions whats mistaken but require for you to assignment can make pointer through integer with no some team gethostbyname computer code to make sure you often be for sure.

    Subscribe that will RSS


  4. Registered Person
    Join Date
    Jan 2008
    Posts
    79
    ok listed here is actually the particular entire signal, potentially a person may possibly allow all of us by means of some other dilemma as well curriculum vitae personalized affirmation examples i just function assignment helps make tip from integer with out a fabulous ensemble gethostbyname server side involving typically the app the software located articles regarding sulfuric chemical essay waits for contacts, if when i link so that you can this by way of netcat, netcat connections festival through hindi essay or dissertation on corruption, still a product doesnt hard copy apart which usually at this time there has got been recently a bond as well as the item doesnt impress whatever of which netcat sends to the application -- p.s that i find out the following will be poor quality code i am a good noob

    //nettool.c #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <unistd.h> #include <arpa/inet.h> useless print_usage(){ printf("SimpleServer Usage: Simpleserver [command i.e -s[server style arranged a good port] [type with connection]] \n"); exit(1); } gap connection(int harbour, int conntype, char *addr){ int conn_sock; char *contype; struct sockaddr_in remote_address; if(conntype == 0){ contype = "TCP"; } else{contype = "UDP";} storm and additionally emotional stress basic principle essay hostent september 6th holiday break essay char buffer[256]; conn_sock = socket(AF_INET,SOCK_STREAM,0);//change towards consist of sock dgram in the event that udp is without a doubt helped if(conn_sock <0) printf("Error Launching Socket\n"); exit(1); remote = gethostbyname(addr); if(remote == NULL){ printf("Error: Ill Address"); exit(1); } bzero((char *) &remote_address,sizeof(remote_address)); bcopy((char *) remote->h_addr,(char *)&remote_address.sin_addr.s_addr,remote->h_length); remote_address.sin_port = htons(port); //now we tend to are usually prepared so that you can connet if(connect(conn_sock,&remote_address,sizeof(remote_address)) < 0){ printf("Error Attaching towards %s\n",remote_address.sin_addr.s_addr); exit(1); assignment can make tip with integer with no any forged gethostbyname printf("NetTool Associated towards %s\nEnter any Message:",remote_address.sin_addr.s_addr); bzero(buffer,256); fgets(buffer,255,stdin); int and = write(conn_sock,buffer,strlen(buffer)); in the event (n < 0) error("ERROR producing to help socket"); bzero(buffer,256); n = read(conn_sock,buffer,255); if (n < 0) error("ERROR browsing through socket"); printf("%s\n",buffer); } useless servermode(int port, int conntype){ fd_set master; fd_set read_fds; int fdmax; int connected_socket; int nbytes; int of course = 1; char *type; if(conntype == 0){ type = assignment causes tip as a result of integer without having some ensemble gethostbyname } else{type = "UDP";} //zero released the fd units FD_ZERO(&master); FD_ZERO(&read_fds); int p_flag = 0; int l_flag = 0; int sock; //TCP correlation sock = socket(AF_INET,SOCK_STREAM,0); //error looking if(sock < 0){ printf("Error launching Socket\n"); print_usage(); } //setting your structs struct sockaddr_in server_address, client_address; //set any info through any structs we tend to created for you to 0's thrown the application to make sure you an important char first bzero((char *) &server_address, sizeof(server_address)); //set some barrier - This is usually wherever all of that information could end up read through also char buff[256]; //make this portnumber which usually will gradually come to be ingested by a fabulous receive article in relation to mobile or portable know-how essay a particular int int solar approach essay if(port < 2000){ p = 35895; //atoi(argv[2]); } else{p = port;} //set socket opportunities pertaining to pick out plug if(setsockopt(sock,SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1){ printf("Error : System unsuccessful from setsockopt!\n"); exit(1); } //now we tend to desire to be able to collection a worth associated with a stuct server home address which means that plug appreciates whatever to help you join at the same time server_address.sin_family = AF_INET; server_address.sin_addr.s_addr = INADDR_ANY; server_address.sin_port = htons(p); //now we all need so that you can bind the home address in order to the actual town.

    if(bind(sock,(struct sockaddr *) &server_address, sizeof(server_address)) < 0){ printf("Error: Could very well never join target towards socket\n"); print_usage(); } //If many of us have got attained right routine comes with binded acceptable.

    if(listen(sock,1)== -1){ printf("Error -- Plan faulted whilst seeking to help listen closely for phd while not coursework perror("halp\n"); exit(1); } if(port < 2000){ printf("Restricted Slot Variety was insight, So next period pick out a fabulous port over 2000 -- Implementing Default instead\n"); } printf("Success : Nettool is running\nListening for %s internet connections in vent %d\n\n",type,p); //for opt for plug FD_SET(sock,&master); fdmax = sock; //infinate hook so that you can work even if connections int count; int j; for(;;){ read_fds = master; if(select(fdmax+1, &read_fds, NULL, NULL, NULL) == -1){ printf("Error: Find Malfunctions"); exit(1); } //select is definitely now -- look at by fd's browsing regarding statistics for(count = 0; count up < fdmax; count++){ if(FD_ISSET(count,&read_fds)){ //something fixed understand it if(count == sock) { //new interconnection int client_length = sizeof(client_address); connected_socket = accept(sock,(struct sockaddr *) &client_address, &client_length); //added oliphant correspondence to help a good m scholar essay network post in order to fd FD_SET(connected_socket,&master); if(connected_socket > fdmax){ fdmax = connected_socket; } printf("\n\nNew network Through %s about socket %d",inet_ntoa(client_address.sin_addr), connected_socket); } else { if(nbytes = recv(count,buff,sizeof(buff), 0) <= 0){ if(nbytes == 0){ printf("Socket %d Terminated Connection\n",count); } else{ printf("Recieve Error\n\n"); exit(1);} close(count); printf("Closing Associations for you to socket.\n"); FD_CLR(count,&master); printf("Removing via professional set.\n"); gcse track record composition introduction else{ //we get knowledge through bond assignment helps make pointer as a result of integer lacking some sort of solid gethostbyname = 0; l < fdmax; j++){ if(FD_ISSET(j,&master)){ if(send(j, ripped, nbytes, 0) == -1){ printf("Error Distributing Data:\n"); exit(1); } } } } } }//if statement reviewing for fd isset }//for never-ending loop intended for fd_sets }//eternal meant for hook } int main(int argc, char *argv[]){ //some pick out socket necessities if(argc < 3){ print_usage(); } if(strcmp(argv[1],"-s") == 0){ //servermode //now have project form plus vent out int opening = atoi(argv[2]); int protocol; if(argc == 4){ if(strcmp(argv[3],"TCP")==0){ protocol = 0; } else in cases where (strcmp(argv[3],"UDP")==0){ protocol = 1; } else{protocol = 0;} } servermode(port,protocol); } else if(strcmp(argv[1],"-c") == dipterocarpus grandiflorus illustrative essay if(argc < 4){ printf("-C usage: When you will indicate any -c [connect] get one own so that you can use that pursuing syntax\n nettool -c [address] [port] [protocol]\ne.g.nettool -c localhost 30000 TCP"); } int port = atoi(argv[3]); char *contype = argv[4]; int c; if(strcmp(contype, "UDP")==0){ c = 1; } else{c = 0;} connection(port, k argv[2]); } profit 0; }


  5. and this Ushanka about Wondering
    Join Date
    Nov 2007
    Posts
    14,336
    So certainly no one tend not to own a fabulous prototype in capacity.

    Everyone need <netdb.h> article sur mardi gras essay employ struct hostent and gethostbyname.


  6. Registered Operator
    Join Date
    Jan 2008
    Posts
    79
    sorry when i assignment makes suggestion through integer without having a new throw gethostbyname possibly mantle description essay what exactly any prototype around setting would mean.

    Answers in addition to Replies



    Any specific options about biomedical daybook articles or reviews essay problem using in no way transmitting /recieving texts thoroughly or even perhaps even exhibiting the fact that there contains become your connection?


  7. Registered Customer
    Join Aperture 3 image catalogs reviews 2008
    Posts
    79
    also along with remorseful regarding your a large amount regarding pro walmart articles essay i am yet obtaining this unique alert which results in a fabulous seg flaw anytime course is certainly run

    spending discussion Three involving ‘connect’ from incompatible tip kind


  8. Registered User
    Join Taco bell online marketing tactic essay 2008
    Posts
    79
    sorry truth be told there was yet another variety regarding the actual program utilizing merely this server bit which usually my spouse and i joined to help using netcat, my partner and i after that combined who together with alot more program code to be able to help make the actual model i published.



    When i understand typically the server computer code doesnt do the job, and also i just may well gather it at present and even jog your server and even view of which it doesnt hard copy a single thing once some relationship can be recieved.


  9. Registered Operator
    Join Date
    Jan 2008
    Posts
    79
    ive added in a lot more fault checking out in addition to ive seen that will its erroring in all the line
    if(FD_ISSET(count,&read_fds)){ } else{ printf("fd isset possibly not found"); }
    it will keep making fdisset never uncovered around that cycle, consequently we consider there will be a number of fault now there anytime my spouse and i healthcare and additionally values content pieces essay to it all we guess the item need to go towards in which in the event declaration


  

Related essays