BeginToLearn
asked on
testing
hi all,
My program is to setup connection from a client to 2 servers. However, I don't know setup those 2 servers to test my code. I can see a weird thing. In [server1] of config file, if i change servername = ubuntu1 which i don't have ubuntu1 system, it can detect
section:[server1] entry1: ubuntu1 entry2:50000
ERROR, no such host
However, it fail can't detect same error when in the second section with servername = ubuntu2. I don't have ubuntu2 system .
Anyway, please advise on how to test my code. tks a lot.
below is the config file
[server1]
servername = ubuntu
port = 50000
[server2]
servername = ubuntu2
port = 37777
client.c
client.h
server.c
My program is to setup connection from a client to 2 servers. However, I don't know setup those 2 servers to test my code. I can see a weird thing. In [server1] of config file, if i change servername = ubuntu1 which i don't have ubuntu1 system, it can detect
section:[server1] entry1: ubuntu1 entry2:50000
ERROR, no such host
However, it fail can't detect same error when in the second section with servername = ubuntu2. I don't have ubuntu2 system .
Anyway, please advise on how to test my code. tks a lot.
below is the config file
[server1]
servername = ubuntu
port = 50000
[server2]
servername = ubuntu2
port = 37777
client.c
client.h
server.c
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I just wonder how you can test it beause the dst will be overlap in the same system. I gonna change the server.c to accept dest from command line.
Now i get the idea on test same system.
How about testing on different systems which are connected by wireless? How to let client look for the right servers to send files?? using IP???
How to make my code can work regardingless to same system or different system? tks a lot.
Now i get the idea on test same system.
How about testing on different systems which are connected by wireless? How to let client look for the right servers to send files?? using IP???
How to make my code can work regardingless to same system or different system? tks a lot.
> I just wonder how you can test it beause the dst will be overlap in the same system
When running 2 instances of the same server on the same system,
although the server ip is same, the server port for both the servers are different.
So, as long as you have different ip for each server, it will run.
> How to let client look for the right servers to send files?? using IP???
Yes, you can use IP.
But, either the server IP has to be a public IP (which is ping'able from client)
or they should be in the same LAN (where both of them share the same subnet).
If you want to use hostname to access the server or client, then you need to register the hostname and corresponding ip address on the DNS server.
> How to make my code can work regardingless to same system or different system?
It is already working, as I explained before.
When running 2 instances of the same server on the same system,
although the server ip is same, the server port for both the servers are different.
So, as long as you have different ip for each server, it will run.
> How to let client look for the right servers to send files?? using IP???
Yes, you can use IP.
But, either the server IP has to be a public IP (which is ping'able from client)
or they should be in the same LAN (where both of them share the same subnet).
If you want to use hostname to access the server or client, then you need to register the hostname and corresponding ip address on the DNS server.
> How to make my code can work regardingless to same system or different system?
It is already working, as I explained before.
ASKER
If you want to use hostname to access the server or client, then you need to register the hostname and corresponding ip address on the DNS server. this is the idea i didn't know and help me understand 1 question in my mind. .
I mean in the same system, 2 servers all will write files to same dst directory. It may corrupt. hihi
I mean in the same system, 2 servers all will write files to same dst directory. It may corrupt. hihi
> this is the idea i didn't know and help me understand 1 question in my mind
So, you will need to configure and run a DNS in your network.
This will take some effort.
But, you can use /etc/hosts file of Linux machine to get the same behavior.
In client machine, add the ip and hostname of the servers.
Both /etc/hosts and DNS will achieve the same thing - resolve a hostname to an IP address.
> I mean in the same system, 2 servers all will write files to same dst directory. It may corrupt. hihi
That is true.
So, it is better, if your server takes destination directory as command line. Or make it part of config file.
So, you will need to configure and run a DNS in your network.
This will take some effort.
But, you can use /etc/hosts file of Linux machine to get the same behavior.
In client machine, add the ip and hostname of the servers.
Both /etc/hosts and DNS will achieve the same thing - resolve a hostname to an IP address.
> I mean in the same system, 2 servers all will write files to same dst directory. It may corrupt. hihi
That is true.
So, it is better, if your server takes destination directory as command line. Or make it part of config file.
ASKER
. I am reworking on my server now. At this moment I will only test for in local system for now because i need to work on more features such as backup, restore, zip, encryption.
the server not only should take destination from commandline but port number as well. in the moment two instances of server would use port 50000 what couldn't work on same host.
Sara
Sara
ASKER
let me change it too
ASKER
after i change the code on several things to test one client to one server:
+ split code to server.c, server.h --> ok
+ receive argument from command line --> ok
+ manipulate path directory. for example the source path is /home/ubuntu/program/src , it should be /home/ubuntu/program/dest , which come from command line
Somehow , it is screwed up now
message2-> dirname is : /home/ubuntu/program/src/d ir1
message2-> dirname is : /home/ubuntu/program/src/d ir1/dir2a
message2-> dirname is : /home/ubuntu/program/src/d ir1/dir2a/ dir4
message2-> dirname is : /home/ubuntu/program/src/d ir1/dir2
message2-> dirname is : /home/ubuntu/program/src/d ir1/dir2/d ir3
message1-> total number of files is 20
message2 -> filename is :/home/ubuntu/program/dest /dir1/dir2 a/dir4/dir 2/dir3/tes t2aa.txt 3947
message2 -> filename is :/home/ubuntu/program/dest /dir1/dir2 a/dir4/dir 2/dir3/td>
<td align="right">
<span style="font-size: 9pt">
<a href="text_compare_alignme nt.html"
onmouseover="document.imag es.prev.sr c='prev-ho t.png'"
onmouseout="document.image s.prev.src ='prev.png '"
><img name=prev src="prev.png" bord
failed to open to append
: File name too long
Could you please take a look?
server.c
server.h
client.c
client.h
+ split code to server.c, server.h --> ok
+ receive argument from command line --> ok
+ manipulate path directory. for example the source path is /home/ubuntu/program/src , it should be /home/ubuntu/program/dest , which come from command line
Somehow , it is screwed up now
message2-> dirname is : /home/ubuntu/program/src/d
message2-> dirname is : /home/ubuntu/program/src/d
message2-> dirname is : /home/ubuntu/program/src/d
message2-> dirname is : /home/ubuntu/program/src/d
message2-> dirname is : /home/ubuntu/program/src/d
message1-> total number of files is 20
message2 -> filename is :/home/ubuntu/program/dest
message2 -> filename is :/home/ubuntu/program/dest
<td align="right">
<span style="font-size: 9pt">
<a href="text_compare_alignme
onmouseover="document.imag
onmouseout="document.image
><img name=prev src="prev.png" bord
failed to open to append
: File name too long
Could you please take a look?
server.c
server.h
client.c
client.h
in createDir you change the dirname you got from commandline. you need to use a tmp as you did it in pareseFileName.
in receiveOneDir you have a local string variable 'dirname' what may give very strange errors when having a member variable of same name.
Sara
in receiveOneDir you have a local string variable 'dirname' what may give very strange errors when having a member variable of same name.
Sara
ASKER
let me fix them . what time do you often leave office?
now. but i can go into the net after supper.
Sara
Sara
ASKER
I see.
It still has same errors
ubuntu@ubuntu:~/program$ g++ -o server server.c
ubuntu@ubuntu:~/program$ ./server /home/ubuntu/program/dest 50000
message2-> dirname is : /home/ubuntu/program/src/d ir1
message2-> dirname is : /home/ubuntu/program/src/d ir1/dir2a
message2-> dirname is : /home/ubuntu/program/src/d ir1/dir2a/ dir4
message2-> dirname is : /home/ubuntu/program/src/d ir1/dir2
message2-> dirname is : /home/ubuntu/program/src/d ir1/dir2/d ir3
message1-> total number of files is 20
message2 -> filename is :/home/ubuntu/program/dest /test2aa.t xt 3947
message2 -> filename is :/home/ubuntu/program/dest /td>
<td align="right">
<span style="font-size: 9pt">
<a href="text_compare_alignme nt.html"
onmouseover="document.imag es.prev.sr c='prev-ho t.png'"
onmouseout="document.image s.prev.src ='prev.png '"
><img name=prev src="prev.png" bord
failed to open to append
: File name too long
ubuntu@ubuntu:~/program$
It still has same errors
ubuntu@ubuntu:~/program$ g++ -o server server.c
ubuntu@ubuntu:~/program$ ./server /home/ubuntu/program/dest 50000
message2-> dirname is : /home/ubuntu/program/src/d
message2-> dirname is : /home/ubuntu/program/src/d
message2-> dirname is : /home/ubuntu/program/src/d
message2-> dirname is : /home/ubuntu/program/src/d
message2-> dirname is : /home/ubuntu/program/src/d
message1-> total number of files is 20
message2 -> filename is :/home/ubuntu/program/dest
message2 -> filename is :/home/ubuntu/program/dest
<td align="right">
<span style="font-size: 9pt">
<a href="text_compare_alignme
onmouseover="document.imag
onmouseout="document.image
><img name=prev src="prev.png" bord
failed to open to append
: File name too long
ubuntu@ubuntu:~/program$
ASKER
you can take a look at my code after dinner meal :) . Tks a lot . I attach the latest server.c
I need to cook too.
server.c
I need to cook too.
server.c
why does message1 arrive after 5 message2?
is the first output from client?
Sara
is the first output from client?
Sara
can you printf the full message2 and sizedata Server::receiveOneFile?
Sara
Sara
also please uncomment the printf in client.c before sending message2.
Sara
Sara
ASKER
let me run it. hold on
ASKER
message2-> dirname is : /home/ubuntu/program/src/d ir1
message2-> dirname is : /home/ubuntu/program/src/d ir1/dir2a
message2-> dirname is : /home/ubuntu/program/src/d ir1/dir2a/ dir4
message2-> dirname is : /home/ubuntu/program/src/d ir1/dir2
message2-> dirname is : /home/ubuntu/program/src/d ir1/dir2/d ir3
message1-> total number of files is 20
Full message2 is: /home/ubuntu/program/src/d ir1/dir2a/ test2aa.tx t 3947
sizedata is : 52
message2 -> filename is :/home/ubuntu/program/dest /test2aa.t xt 3947
Full message2 is: ¿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<!-- saved from url=(0029)http://www.helpandmanual.com/ -->
<head>
<title>Text Compare Replacements</title>
<meta name="generator" content="Help & Manual" />
<meta name="keywords" content="replacements,text replacements" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style- Type" content="text/css" />
<link type="text/css" href="default.css" rel="stylesheet" />
<script type="text/javascript" src="helpman_topicinit.js" ></script>
<!-- Redirect browser to frame page if page is not in the content frame. -->
<script type="text/javascript">
<!--
if (location.search.lastIndex Of("toc=0" )<=0) {
if (parent.frames.length==0) { parent.location.href="inde x.html?tex t_compare_ replacemen ts.html"; }
else { parent.quicksync('a3.3.3.4 '); }
}
//-->
</script>
<script type="text/javascript" src="highlight.js"></scrip t></head>
<body style="margin: 0px 0px 0px 0px; background: #FFFFFF;" onload="highlight();">
<div id="hmpopupDiv" style="visibility:hidden; position:absolute; z-index:1000; "></div>
<table width="100%" border="0" cellspacing="0" cellpadding="5"
style="margin: 0px; background: #B01213 url(red-bg.jpg) -12px 0px repeat-y;">
<!-- <table width="100%" border="0" cellspacing="0" cellpadding="5" bgcolor="#B01213"> -->
<tr valign="middle">
<!-- <td style="width: 10px"> </td> -->
<td align="left">
<p class="p_Heading1"><span class="f_Heading1">Text Compare Replacements </span><img src="pro.png" width="27" height="12" border="0" alt=""></p>
<p class="p_Command2"><span class="f_Command2">Session > Session Settings > Replacements</span></p>
</td>
<td align="right">
<span style="font-size: 9pt">
<a href="text_compare_alignme nt.html"
onmouseover="document.imag es.prev.sr c='prev-ho t.png'"
onmouseout="document.image s.prev.src ='prev.png '"
><img name=prev src="prev.png" bord
sizedata is : 2048
message2 -> filename is :/home/ubuntu/program/dest /td>
<td align="right">
<span style="font-size: 9pt">
<a href="text_compare_alignme nt.html"
onmouseover="document.imag es.prev.sr c='prev-ho t.png'"
onmouseout="document.image s.prev.src ='prev.png '"
><img name=prev src="prev.png" bord
failed to open to append
: File name too long
ubuntu@ubuntu:~/program$
Oh the first five message2 indicate about directories.
message2-> dirname is : /home/ubuntu/program/src/d
message2-> dirname is : /home/ubuntu/program/src/d
message2-> dirname is : /home/ubuntu/program/src/d
message2-> dirname is : /home/ubuntu/program/src/d
message1-> total number of files is 20
Full message2 is: /home/ubuntu/program/src/d
sizedata is : 52
message2 -> filename is :/home/ubuntu/program/dest
Full message2 is: ¿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<!-- saved from url=(0029)http://www.helpandmanual.com/ -->
<head>
<title>Text Compare Replacements</title>
<meta name="generator" content="Help & Manual" />
<meta name="keywords" content="replacements,text
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-
<link type="text/css" href="default.css" rel="stylesheet" />
<script type="text/javascript" src="helpman_topicinit.js"
<!-- Redirect browser to frame page if page is not in the content frame. -->
<script type="text/javascript">
<!--
if (location.search.lastIndex
if (parent.frames.length==0) { parent.location.href="inde
else { parent.quicksync('a3.3.3.4
}
//-->
</script>
<script type="text/javascript" src="highlight.js"></scrip
<body style="margin: 0px 0px 0px 0px; background: #FFFFFF;" onload="highlight();">
<div id="hmpopupDiv" style="visibility:hidden; position:absolute; z-index:1000; "></div>
<table width="100%" border="0" cellspacing="0" cellpadding="5"
style="margin: 0px; background: #B01213 url(red-bg.jpg) -12px 0px repeat-y;">
<!-- <table width="100%" border="0" cellspacing="0" cellpadding="5" bgcolor="#B01213"> -->
<tr valign="middle">
<!-- <td style="width: 10px"> </td> -->
<td align="left">
<p class="p_Heading1"><span class="f_Heading1">Text Compare Replacements </span><img src="pro.png" width="27" height="12" border="0" alt=""></p>
<p class="p_Command2"><span class="f_Command2">Session
</td>
<td align="right">
<span style="font-size: 9pt">
<a href="text_compare_alignme
onmouseover="document.imag
onmouseout="document.image
><img name=prev src="prev.png" bord
sizedata is : 2048
message2 -> filename is :/home/ubuntu/program/dest
<td align="right">
<span style="font-size: 9pt">
<a href="text_compare_alignme
onmouseover="document.imag
onmouseout="document.image
><img name=prev src="prev.png" bord
failed to open to append
: File name too long
ubuntu@ubuntu:~/program$
Oh the first five message2 indicate about directories.
ASKER
in dest all subdirectories were created in wrong hierarchy. Let me check those directory path processing
ASKER
I go to work now until midnight.if u see anything wrong,pleas post it.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
So, when you call pareseFileName(), the itssize has to get back the size of the file.
This is not happening.
This is not happening.
Because of this, the loop:
while( nread < itssize )
is never entered.
while( nread < itssize )
is never entered.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
iam going home now.i honna try in 36"
Since you are writing and reading only strings and integers,
it is better to use fscanf() and fprintf() instead of read/write and send/recv.
read/write and send/recv will work on binary data.
fscanf/fprintf will work on formatted data and it is better to use these functions when you are using strings and integers.
it is better to use fscanf() and fprintf() instead of read/write and send/recv.
read/write and send/recv will work on binary data.
fscanf/fprintf will work on formatted data and it is better to use these functions when you are using strings and integers.
ASKER
back to action. I am reading all comments now.
i don't agree to the usage of fscanf and fprintf in c++. formatted i/o using those functions is error-prone and not type-safe. it also can used by malware to overtake a program.
begintolearn, you might think on rename your .c files into .cpp. otherwise, you often will get suggestions to use techniques which might be right for a c program but are not recommended in a c++ environment.
Sara
begintolearn, you might think on rename your .c files into .cpp. otherwise, you often will get suggestions to use techniques which might be right for a c program but are not recommended in a c++ environment.
Sara
ASKER
here is my latest server. The directory hierarchy is wrong.
For general, i think fwrite/fread can handle both binary and text. I will rename after this work.
server.c
For general, i think fwrite/fread can handle both binary and text. I will rename after this work.
server.c
ASKER
i see the problem now.
The directory from command line is the same during my code . So when the directory from message come, it use dirname in private as the reference. So all directory will be flat.
The directory from command line is the same during my code . So when the directory from message come, it use dirname in private as the reference. So all directory will be flat.
ASKER
I think of this approach:
+ save the directory path from command line in a string
+ initilize dirname with directory path by constructor
+ when call createDir, use dirname as reference ; then update dirname
+ after done createDir, restore the original directory path from commandline to dirname. now work with files.
how do u think?
+ save the directory path from command line in a string
+ initilize dirname with directory path by constructor
+ when call createDir, use dirname as reference ; then update dirname
+ after done createDir, restore the original directory path from commandline to dirname. now work with files.
how do u think?
ASKER
i gonna go to sleep now because it's 1:26 am . sorry.
you could send relative directory paths from client. then you could add the paths to that you got from commandline. for example send src/dir1 from client and then you could add it to /home/ubuntu/programs/serv er1/ at the server (1) side.
Sara
Sara
ASKER
I will think about it carefully in the morning. tks.
sarabande> begintolearn, you might think on rename your .c files into .cpp. otherwise, you often will get
sarabande> suggestions to use techniques which might be right for a c program but are not
sarabande> recommended in a c++ environment
Just by changing from .c to .cpp will not change anything.
Inside the program, there are calls to send(), recv(), write(), etc.
Without changing these, it will still be C code only.
Since he/she is already using these C calls, I suggested fscanf() and fprintf().
sarabande> formatted i/o using those functions is error-prone and not type-safe
I don't agree with this statement.
Can you please give me examples, where it is going to be error prone?
If you use same data type to send and recv the parameters on both server and client, then there will be no problem with type also.
sarabande> suggestions to use techniques which might be right for a c program but are not
sarabande> recommended in a c++ environment
Just by changing from .c to .cpp will not change anything.
Inside the program, there are calls to send(), recv(), write(), etc.
Without changing these, it will still be C code only.
Since he/she is already using these C calls, I suggested fscanf() and fprintf().
sarabande> formatted i/o using those functions is error-prone and not type-safe
I don't agree with this statement.
Can you please give me examples, where it is going to be error prone?
If you use same data type to send and recv the parameters on both server and client, then there will be no problem with type also.
do you want to say the variable arguments are type-safe? isn't it that you can get severe errors when typing a wrong number of arguments or wrong argument type not fitting to format specifiers for both scanf and printf where you don't get any hint of compiler? by manipulating the format specifier string a mal program can produce buffer overflow or manipulate return addresses in stack.
send/recv are not the same as printf/scanf. i don't argue against using c runtime calls especially not where there is no c++ alternative. i don't see any reason in the above program to use fprintf and fscanf as alternative to the (working) recv and send and the argument it will keep to be c code only when not replacing one c function by another is not logical.
Sara
send/recv are not the same as printf/scanf. i don't argue against using c runtime calls especially not where there is no c++ alternative. i don't see any reason in the above program to use fprintf and fscanf as alternative to the (working) recv and send and the argument it will keep to be c code only when not replacing one c function by another is not logical.
Sara
sarabande> isn't it that you can get severe errors when typing a wrong number of arguments or wrong
sarabande> argument type not fitting to format specifiers
Here below I reproduce what I had mentioned:
"If you use same data type to send and recv the parameters on both server and client, then there will be no problem with type also"
And making a mistake in program (sending wrong number of arguments, etc), can happen with other function calls also and your compiler might not give errors.
So, this point doesn't justify not using fprintf() and fscanf().
sarabande> send/recv are not the same as printf/scanf.
Where did I say, both are same?
I only said, it is convenient to use fprintf() and fscanf().
In this program, every send() call sends 2 values - 1 string and 1 integer.
So, the same has to be received at the other end.
If I use send() and recv(), you will have to take care of splitting the data, rightly checking the end of data, etc.
If you use fprintf() and fscanf(), you don't need to do any splitting of parsing.
I feel, it is more convenient to use formatted read/write such as fprintf() and fscanf().
They are there to make our life easy in these kind of situations.
That is my suggestion.
It is left to "BeginToLearn" to use it or not.
sarabande> argument type not fitting to format specifiers
Here below I reproduce what I had mentioned:
"If you use same data type to send and recv the parameters on both server and client, then there will be no problem with type also"
And making a mistake in program (sending wrong number of arguments, etc), can happen with other function calls also and your compiler might not give errors.
So, this point doesn't justify not using fprintf() and fscanf().
sarabande> send/recv are not the same as printf/scanf.
Where did I say, both are same?
I only said, it is convenient to use fprintf() and fscanf().
In this program, every send() call sends 2 values - 1 string and 1 integer.
So, the same has to be received at the other end.
If I use send() and recv(), you will have to take care of splitting the data, rightly checking the end of data, etc.
If you use fprintf() and fscanf(), you don't need to do any splitting of parsing.
I feel, it is more convenient to use formatted read/write such as fprintf() and fscanf().
They are there to make our life easy in these kind of situations.
That is my suggestion.
It is left to "BeginToLearn" to use it or not.
ASKER
good morning. let me continue.
ASKER
My solution doesn't work. Below is the reason
commandargument : /home/ubuntu/program/dest
message2-> dirname is : /home/ubuntu/program/src/d ir1
----> directory path will be /home/ubuntu/program/dest/ dir1
update dirname = /home/ubuntu/program/dest/ dir1
message2-> dirname is : /home/ubuntu/program/src/d ir1/dir2a
----> directory path will be /home/ubuntu/program/dest/ dir1/dir2a
update dirname = /home/ubuntu/program/dest/ dir1/dir2a
message2-> dirname is : /home/ubuntu/program/src/d ir1/dir2a/ dir4
----> directory path will be /home/ubuntu/program/dest/ dir1/dir2a /dir4
update dirname = /home/ubuntu/program/dest/ dir1/dir2a /dir4
message2-> dirname is : /home/ubuntu/program/src/d ir1/dir2
----> directory path will be /home/ubuntu/program/dest/ dir1/dir2a /dir4
update dirname = /home/ubuntu/program/dest/ dir1/dir2a /dir4
message2-> dirname is : /home/ubuntu/program/src/d ir1/dir2/d ir3
----> directory path will be /home/ubuntu/program/dest/ dir1/dir2a /dir4/dir3
wrong !!!!! it should be /home/ubuntu/program/dest/ dir1/dir2a /dir3
update dirname = /home/ubuntu/program/dest/ dir1/dir2a /dir4/dir3
commandargument : /home/ubuntu/program/dest
message2-> dirname is : /home/ubuntu/program/src/d
----> directory path will be /home/ubuntu/program/dest/
update dirname = /home/ubuntu/program/dest/
message2-> dirname is : /home/ubuntu/program/src/d
----> directory path will be /home/ubuntu/program/dest/
update dirname = /home/ubuntu/program/dest/
message2-> dirname is : /home/ubuntu/program/src/d
----> directory path will be /home/ubuntu/program/dest/
update dirname = /home/ubuntu/program/dest/
message2-> dirname is : /home/ubuntu/program/src/d
----> directory path will be /home/ubuntu/program/dest/
update dirname = /home/ubuntu/program/dest/
message2-> dirname is : /home/ubuntu/program/src/d
----> directory path will be /home/ubuntu/program/dest/
wrong !!!!! it should be /home/ubuntu/program/dest/
update dirname = /home/ubuntu/program/dest/
ssnkumar, the recv cannot be replaced by fscanf cause the above program receives binary data from a tcp/socket. there is a 1st recv call which reads an integer from socket which tells the length of the next message. tcp/ip doesn't guarantee that a message sent with one call was received with one call. instead you must call recv in a loop until the expected length was read. if you don't do it that way you might read only a part of the message. if you try to read more than what was sent, the function finally hangs.
Sara
Sara
will you try sending relative paths?
Sara
Sara
ASKER
I am thinking about your approach now.
>>you could send relative directory paths from client. then you could add the paths to that you got from >>commandline. for example send src/dir1 from client and then you could add it to /home/ubuntu/programs/serv er1/ at the server (1) side.
what if /home/ubuntu/program/src in client and server has different location such as /home/ubuntu/Desktop?
>>you could send relative directory paths from client. then you could add the paths to that you got from >>commandline. for example send src/dir1 from client and then you could add it to /home/ubuntu/programs/serv
what if /home/ubuntu/program/src in client and server has different location such as /home/ubuntu/Desktop?
ASKER
your solution requires sending more info from clien to server? Could you please explain more?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
you mean like this
. in client , use the command line argument to drop relative path so it can drop /home/ubuntu/program/src
to get
dir1/..
dir1/dir2a/....
and the add that with the command argument in server
right :)? if so , i completely forget to use command argument in client hihi
. in client , use the command line argument to drop relative path so it can drop /home/ubuntu/program/src
to get
dir1/..
dir1/dir2a/....
and the add that with the command argument in server
right :)? if so , i completely forget to use command argument in client hihi
good.
in client you need the /home/ubuntu/program/src to know from where the files should be taken :)
Sara
in client you need the /home/ubuntu/program/src to know from where the files should be taken :)
Sara
ASKER
let me implement it now . tks
ASKER
I think about this. I can determine the length of command argument. So i can you substr to drop relative path. Is it a good way to implement it?
ASKER
so far so good. all directories are in order now :) I am reviewing for files to make sure they will transfer to proper directory :) i guess you are leaving office now Sara.
ASKER
After i update my code, it works for one client to one server :)
I am testing the case one client to 2 servers. It doesn't work. It only transfer files form src to dest1; but dest2 is empty ( i use src, dest1,dest2 while testing)
Could you please take a look at it?
client.c
client.h
server.c
server.h
config
I am testing the case one client to 2 servers. It doesn't work. It only transfer files form src to dest1; but dest2 is empty ( i use src, dest1,dest2 while testing)
Could you please take a look at it?
client.c
client.h
server.c
server.h
config
ASKER
let me close this question. Tks for your help.
ASKER