LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-04-2006, 01:04 AM   #1
saurabhtopno
LQ Newbie
 
Registered: May 2006
Location: Hyderabad,INDIA
Posts: 3

Rep: Reputation: 0
error#113


Following is the CLIENT program in Fedora 4.0:-

#include<stdlib.h>
#include<stdio.h>
#include<netinet/udp.h>
#include<netinet/in.h>
#include<sys/types.h>
#include<arpa/tftp.h>
#include<arpa/inet.h>
#include<sys/socket.h>
#include<fcntl.h>
#include<string.h>
//#include<unistd.h>
#include<malloc.h>
#include<time.h>
#include"tft.h"

#define serv_port 69
#define serv_ipaddr "192.168.1.34"

struct wr_rq read_packet,write_packet;
struct wr_rq tftp_serv;

void read_request(struct wr_rq *r)
{
printf("\n%d\n%s\n%s\n%d\n%d\n%d",r->wr_opcode,r->wr_filename,r->wr_mode,r->wr_nul,r->wr_nul1);
}

int main()
{
int a,sockfd,newsockfd;
int ret,i=0;
void read_request(struct wr_rq *);
struct wr_rq r1 = { 37,"text.txt","RDONLY",00,00};
struct wr_rq r2;
struct sockaddr_in serv;
sockfd=socket(AF_INET,SOCK_STREAM,0);

bzero((char *)&serv, sizeof(serv));
servaddr.sin_family=AF_INET;
servaddr.sin_port=serv_port;
servaddr.sin_addr.s_addr=inet_addr(serv_ipaddr);

if(connect(sockfd,(struct sockaddr *)&serv,sizeof(serv))<0)
{
perror("connect");
exit(2);
}
ret=write(sockfd,&r1,sizeof(r1));
printf("\nret= %d\n",ret);

printf("\nfilename:%s\n",r1.wr_filename);

close(newsockfd);

}


Next,Following is the SERVER program:-


#include<stdlib.h>
#include<stdio.h>
#include<netinet/udp.h>
#include<netinet/in.h>
#include<sys/types.h>
#include<arpa/tftp.h>
#include<arpa/inet.h>
#include<sys/socket.h>
#include<fcntl.h>
#include<string.h>
//#include< unistd.h>
#include<malloc.h>
#include"tft.h"

#define serv_port 69
#define serv_ipaddr "192.168.1.36"

struct wr_rq read_packet,write_packet;
struct wr_rq tftp_serv;

int main()
{
int a,sockfd,newsockfd;
int ret,i=0;
struct wr_rq buf;
struct wr_rq w1 = { 33,"new","RDONLY",00,00};
struct sockaddr_in serv;
sockfd=socket(AF_INET,SOCK_STREAM,0);

bzero((char *)&serv, sizeof(serv));
servaddr.sin_family=AF_INET;
servaddr.sin_port=serv_port;
servaddr.sin_addr.s_addr=inet_addr(serv_ipaddr);

if(bind(sockfd,(struct sockaddr *)&serv,sizeof(serv)) < 0)
{
perror("bind");
exit(2);
}
listen(sockfd,5);

newsockfd=accept(sockfd,0,0);

ret=read(newsockfd,&buf,sizeof(buf));
printf("\nret= %d\n",ret);

printf("\nfilename:%s\nmode%s\nopcode%d\n",buf.wr_filename,buf.wr_mode,buf.wr_opcode);
close(newsockfd);
}

When the above two programs run, i get an error message in the CLIENT
side:->Connect:No route to host.After using errno,i got the error number 113.What does it mean???please help me.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Port 113 floppywhopper Linux - Security 7 02-07-2008 07:51 PM
OOo1.9.113 compile error Archive/Zib.pm perl5 Randall Slack Slackware 3 07-09-2005 06:10 AM
dport 113 yoursmile Linux - Networking 2 06-23-2005 10:58 PM
port 113 jthepro Linux - Networking 2 05-24-2004 01:52 PM
113 port spank Linux - Newbie 3 12-02-2003 04:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration