d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Chat Program - C Coding
Add Reply New Topic New Poll
Member
Posts: 18,969
Joined: Aug 16 2007
Gold: 16,089.87
Oct 26 2013 04:33pm
On the last project we had a server and client and had the client talk to the server, now we need the client and server to talk to each other instead of just one way.

I need it to prompt the client first - send message, then server - send message, and back and forth (Do not need to be able to send multiple messages, just one each until it receives a message)

I was wondering if anybody could help look at my code and tell me how to implement this? (Willing to donate to help me through this :) )

I need both to be able to receive and both send instead of client sending only and server receiving only.

The most important part is just talking back and forth, that's where I'm needing, not so much the rest. Just need help implementing and understanding!

Steps:
Server -
  • Block to receive a chat packet from the client.
  • Receive chat packet, compute and check the packet's checksum, and print message to screen. If the checksum does not match, print an error.
  • Prompt the user for a message to send.
  • Prompt the user for a message to send.
  • Add new message to chat packet with updated packet fields (including new computed checksum).
  • Send the chat packet to the client.
  • Goto step 3
Client -
  • Set up a TCP connection to the server on the IP and port specified.
  • Prompt the user for a message to send.
  • Add message to a chat packet with updated packet fields (including computed checksum).
  • Send the chat packet to the server.
  • Block to receive a chat packet from the server.
  • Receive chat packet, compute and check the packet's checksum, and print message to screen. If the checksum does not match, print an error.
  • GOTO step 2.


This post was edited by Trev on Oct 26 2013 04:34pm
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Oct 26 2013 04:45pm
I can take a look. Shoot me the source in a PM.
Member
Posts: 18,969
Joined: Aug 16 2007
Gold: 16,089.87
Oct 27 2013 02:49pm
Never got a response back, not sure what happened heh
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Oct 27 2013 03:27pm
Quote (Trev @ Oct 27 2013 04:49pm)
Never got a response back, not sure what happened heh


you only waited a day. not everyone is always on jsp
Member
Posts: 18,969
Joined: Aug 16 2007
Gold: 16,089.87
Oct 27 2013 03:32pm
Quote (carteblanche @ Oct 27 2013 04:27pm)
you only waited a day. not everyone is always on jsp


You're right, I just through a few ideas at him and didn't get a response
Member
Posts: 18,969
Joined: Aug 16 2007
Gold: 16,089.87
Oct 27 2013 04:18pm
Found this website, and it seems to have all that I'm looking for, but I'm slightly confused on where to put things.

http://www.binarytides.com/socket-programming-c-linux-tutorial/
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll