Jump to content

Client-Server Connection

- - - - -

  • Please log in to reply
4 replies to this topic

#1
Apprentice123

Apprentice123

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 430 posts
I'm needing some ideas on how emulates the connection between client and server for exchanging packets between them.

thanks

#2
Apprentice123

Apprentice123

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 430 posts
Let me see... I need:

Client:
Create a TCP socket
Establish connection
Communicate
Close the connection


Server:
Create a TCP socket
Assign a port to socket
Set socket to listen
Repeatedly:
-Accept new connection
-Communicate
-Close the connection


How can I create a TCP socket ? What do I need to create? How do I set up the client and server classes?

#3
AdvMutant

AdvMutant

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 438 posts
Just asking, are you using C or C++? I've been trying to the the same with C but I lost interest.

Posted Image
There is no problem that cannot be solved by the use of high explosives.


#4
Flying Dutchman

Flying Dutchman

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 889 posts
  • Location:::1
Platform?

Windows: madwizard.org, winsock tutorial, C++ Socket class
Linux: linuxhowtos.org

Note that it's basicly the same, only on Windows you have to make like 3 extra functions calls before you start sending data over interwebz.
A conclusion is where you got tired of thinking.
#define class struct    // All is public.

#5
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
  • Location:New York, NY
For Linux socket programming, I would highly recommend Beej's Guide to Network Programming.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users