Hi:
I need a C source-code that implements a simulated client/server model
using POSIX threads. With the following requirements:
1) Multiple clients needs to be spawned using POSIX threads
2) There can be multiple servers or a single server (does not really
matter)
3) The communication channel between the client and the server has to
TCP or UDP using sockets.
4) The program must be executable in at least ONE of the following
OS': UNIX*, SOLARIS, LINUX*
5) What this program does is irrelevant. It could be a chat program or
anything as long as the above requirements are met.
Please note I am not asking you to write the program but rather find
one in the internet that is very similar to the above. That's why I
have such as a subdued price for this question. Also, I am willing to
be a little more flexible in terms of my specification given you let
me know what you have come across.
Finally, if you believe you can come up with the source-code given you
have more time, which means for an additional amount, please let me
know.
Thanks
Salman. |
Clarification of Question by
salman1-ga
on
27 Apr 2003 23:39 PDT
I forgot to mention: The source-code must be complete and compilable.
|
Request for Question Clarification by
dogbite-ga
on
28 Apr 2003 20:29 PDT
Hello salman1-ga,
I am very familiar with POSIX threads
and networking code. Unfortunately, I
am not aware of any code freely available
on the Internet that has both a server/
client thread model and sockets. The
server/client thread model examples that
I know of use mutexs and conditional signals
to pass and share data.
I could write a custom example program for
you. I would do it for $50.
Please let me know if you would like me
to do that.
dogbite-ga
|
Clarification of Question by
salman1-ga
on
28 Apr 2003 22:13 PDT
dogbite-ga,
Can you clarify what you mean by: "...custom example program...". Does
that mean you will write a program that meets all my requirements?
|
Request for Question Clarification by
dogbite-ga
on
28 Apr 2003 22:19 PDT
Hi salman1-ga,
Yes, I will write a program that:
1) is a single process with one "server"
thread and several "client" threads,
2) has client threads communicating with
the server thread using a UDP socket, and
3) will work on linux.
Will that suit your needs?
dogbite-ga
|
Clarification of Question by
salman1-ga
on
29 Apr 2003 08:38 PDT
That's great dogbite-na. I realize I asked for either UDP/TCP -
however do you think you can use TCP instead [I would prefer that].
That would be great. If you can do that start working on it.
Thanks
Salman.
|
Clarification of Question by
salman1-ga
on
29 Apr 2003 08:39 PDT
One other thing, how do I give you the extra $40 bucks?
|
Request for Question Clarification by
dogbite-ga
on
29 Apr 2003 09:32 PDT
Hi salman1-ga,
Yes, I could use TCP instead
of UDP. That isn't a problem.
May I ask why you want to use
sockets at all? It seems that
you kind of defeat the point of
threads if you're not using shared
memory to communicate. Why not
write the server and clients as
separate processes if you're going
to use sockets for communication?
As for the $40 -- you can just put
it in the "tip" box when you submit
your review, after I submit the answer.
Let me know about the sockets, and I'll
go ahead and start working on it. I can
finish it within 1 day.
dogbite-ga
|
Clarification of Question by
salman1-ga
on
29 Apr 2003 10:32 PDT
Hey dogbite-ga:
Yes, you can separate the client and server into different processes
and possibly even separate executables. That's okay. However, the
clients (probably an array of them) *has to be* spawned using PThreads
and they [the clients] will send text-messages to the server. That's
about it.
Thanks
Salman.
|
Request for Question Clarification by
dogbite-ga
on
29 Apr 2003 12:17 PDT
Hey salman1-ga,
Excellent. Just to be clear, we will
now have two processes. A server
process and a client process. The
client process will have several
threads, all of which create separate
TCP connections with the server.
Is that okay?
dogbite-ga
|
Clarification of Question by
salman1-ga
on
29 Apr 2003 13:00 PDT
dogbite-ga,
Yes, that's perfect.
|
Hello salman1-ga,
Okay, I wrote the two programs
and have put their source code here:
http://nms.lcs.mit.edu/~gch/google/clientserver.tar.gz
The file also contains a README
explaining how to use them. The
programs are a simple echo client
and server -- the server sends back
exactly what the clients send it.
I hope the programs meet your needs exactly.
dogbite-ga |
Request for Answer Clarification by
salman1-ga
on
29 Apr 2003 14:40 PDT
Everything LOOKS PERFECT!!! Great great work.
Can you make one final change. Can you change client.c so that it
accepts through argv one argument which is the host name to the server
so that the client can send messages from different a machine? If it's
too much change forget it, and let me know.
You have done a lot - Thanks,
Salman.
|
Clarification of Answer by
dogbite-ga
on
29 Apr 2003 16:00 PDT
Hello salman1-ga,
Okay, I made the change and have
updated the file here:
http://nms.lcs.mit.edu/~gch/google/clientserver.tar.gz
It optionally takes an IP address
on the command line. Note that it
does not take a hostname because I
didn't want to put the code in to
resolve the name to an IP number.
So now you can connect to any server.
And, I'm glad you're happy with the code.
For $50, I'm happy to write it for you. :-)
dogbite-ga
|