Developing chat application

S

sangeetha

Hello,

I've assigned to develop a simple chat application using "C" program.
I've written program but missing one thing. Simultaneously both user
can type in their window. But i dont know how to implement this, in
such way that at all the time, same thread/process should be able to
send and recieve message from/to between their desination.

I've written code, in that once the user1 typed the message, it cant
send an another message untill it gets a message from the user2. Becoz
i 've coded as receive and send in user2, and in user1 send and
receive. I believe i've explained my problem.

I think i'm missing some where, can any one point how to achieve this.

Best regards,
Sangeetha.
 
M

Malcolm

sangeetha said:
I've assigned to develop a simple chat application using "C" program.
I've written program but missing one thing. Simultaneously both user
can type in their window. But i dont know how to implement this, in
such way that at all the time, same thread/process should be able to
send and recieve message from/to between their desination.

I've written code, in that once the user1 typed the message, it cant
send an another message untill it gets a message from the user2. Becoz
i 've coded as receive and send in user2, and in user1 send and
receive. I believe i've explained my problem.
If you're writing for a desktop system, you will probably need two
"clients", terminals with VDU and keyboard.
C doesn't specify how to do this. ANSI C programs just have stdin and
stdout, which are inherently single streams and support only one user. You
need to look at the libraries on your system, which is probably either X or
MS Windows.
 
K

Kieran Simkin

sangeetha said:
Hello,

I've assigned to develop a simple chat application using "C" program.
I've written program but missing one thing. Simultaneously both user
can type in their window. But i dont know how to implement this, in
such way that at all the time, same thread/process should be able to
send and recieve message from/to between their desination.

I've written code, in that once the user1 typed the message, it cant
send an another message untill it gets a message from the user2. Becoz
i 've coded as receive and send in user2, and in user1 send and
receive. I believe i've explained my problem.

I believe you haven't explained it very well. However, could this be an
issue with blocking sockets? Ie, you're waiting for a message from the other
end of your connection and program is blocking on the receive call? Anyway,
sockets are off-topic here, so you will not get the best advice, best go
find a newsgroup dedicated to your specific platform. However, if the
problem is as I've described, either look into non-blocking sockets, or
consider a multi-process setup.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,146
Messages
2,570,832
Members
47,374
Latest member
EmeliaBryc

Latest Threads

Top