Quote (Eep @ Jan 29 2013 10:14pm)
wow..
I just read up a bit about sockets the other day (not for class, for fun).....I also read a little win32 tut on how to create a simple BLOCKING socket? in c++.
I am pretty interested in network comm. and how that all works.
The code here
http://www.win32developer.com/tutorial/winsock/winsocktutorial1.shtmseems relatively light, but I feel there is a lot more to it probably?
Also curious as to how sockets work when you modularize programs....what file do you put that sort of stuff in lol? Or would it belong to a class? Beats me ><
theres really nothing else to sockets then that. the rest of it is pretty much how you interact with them.
you can most likely take one of your earlier projects you made and pit all the `cin` inputs in the client but instead of using `cin` use send() and on server replace `cout` with send() (after using recv to get the data of course).
pretty much lets use the libaray booking program most people have to do.
normal program flow:
app) enter book id
app) searches file for book id
app) spits out errors or messages
client server model
client) enter a book code to search for ( send()'s it to the server)
server) recv()'s the code and searches for it (lets assume we store this in a file, server gets the id searches for the book code)
server) sends()'s weither the book is in stock or an error
client) recv()'s the message
client) asks user for another code to send
basically once the sockets are connected (basically what the tutorial shows you how to do) you do w/e you would do with files but remotely. just think of the roles of what the server would do and what the client will do and start coding.
This post was edited by AbDuCt on Jan 29 2013 08:37pm