How would I add libws2_32.a to visual studios 2010? It's a linker file, yes?
I'm getting these weird errors that consist of " 1>Socket.obj : error LNK2019: unresolved external symbol __imp__socket@12 referenced in function "public: __thiscall Socket::Socket(void)" (??0Socket@@QAE@XZ)"
One thing I haven't gotten with Winsock, is getting it to run over a WAN. On my home network it ran fine., but I once tried to get it to work over internet, and it didn't work. Also file transfer is something I haven't gotten to.
What's the point of the SendData() function? It returns true - but it always returns true no matter if send() failed or not, why is it not checked?
if( send( ... ) != SOCKET_ERROR )
return true;
else
return false;
??? I have to say I first was positive about this tutorial and thought it was better than those out there in the internet but I get disappointed more and more..
@mySaigaAntilope It was pretty incomplete, yes. I'm sorry for the quality, it is quite old, and back then it was hard to get anybody to peer review my tutorials. Hopefully what I release in the future will be better quality, once I have time again to make tutorials (really busy w/ full time software engineering jobs since I've been out of college).
@vitorix24 No no no no no no no. C++ is much more than an extension of libraries on top of C. C++ is a completely different language, and while C is compatible with C++, C++ is not compatible with C.
C++ is a multi-paradigm language, so on top of your basic C functionality it also includes Object Oriented designs as well as Templating.
Polymorphism, Encapsulation, Inheritance, all are parts of C++ that are not parts of C, and using C++ with only C functionality is a waste of the language.
Awesome videos lusikkamage. One small problem though. When I try connecting to another computer via IP address, I'm still able to type messages and send them but the other computer doesn't seem to be recieving them. Any ideas why? Tried playing about with firewall but to no avail :(
Socket programming is almost in a league of its own. I use the Windows API regularly and anytime I look at Winsock functions, they seem to be very different.
Don't worry, compared to someone else, we ALL know barely anything =D
I've been programming and developing Internet programs for years, but I've ALWAYS wished I knew how to program and do 3d graphics rasterization and rendering like John Carmack or even Ken Silverman; but I just don't have the time (or the patience) ='P
A very nice example, though the dots and the : are very hard to notice.
However, the project files are uploaded and many thanks for that. It's very hard to to program with sockets, hard to understand..
However, winsock does not work with linux, the two library's are very similar but you should have included that in this tutorial. Programming for 1 O.S. just isn't the way to go.
Thank you for this tutorial, I am working on a multi-player game in C++ but I have been struggling a little with WinSock, this really helped me! I have subscribed!
Yeah, but if you don't already know how to create a GUI in C++ you should probably research that first, either using Visual Studio's tool, something like wxWidgets, or writing your own with Allegro/SDL.
I know how to create a GUI, but I think I can't use blocking sockets in GUI, so what can you offer? Maybe Async? I've been googling for sockets in GUI using C++, but there are many tuts using VB - not C++.
I don't know very much about sockets and such, when I used it for a game I was working on I used blocking sockets, but my program was multithreaded so it'd run the socket stuff on a separate thread.
nice, thanks for this tutorial. I have been socket programming in C# and I am starting to move onto C++ now. It is really hard for a 15 year old though, are you self taught? or did you go to school?
@HordeAreMyFatCousins Why dod you assume a 15 year old? From the voice i think it's a woman with quite a lot of knowledge about programming. No pun intended at all.
This is very nice of you to take time out to help beginners. It would be very cool to see you take it further - maybe make a game lobby then once all clients are connected switch to UDP for the main game - but only if your not too busy :-P
Is there any way to remake this program in a chat app like skype? I mean that you would be able to write another message right after the first one, that you don't have to wait for a message from another user.
well your a very good coder, iam just starting to learn c++, and its easyer than i tought it would be, and its sorta giveing me insight of all those games i used to play.. its quite interesting realy :)
I want to start learning about this kind of stuff (Online apps) because I want to make an Online game in the future. What should I learn? Should I stick with winsock? Or maybe search for another Networking Lib?
Good tutorial. Why did you give a direct refrence to the lib? With codeblocks using GCC You can just as easly type ws2_32 and it will find it by scanning your dir's
sadly ive decide to back down from allegro and SDL and decided to do DirectX 9...then recently(now) im doing XNA C# ...its extrememly OOP but still awesome ;)
well sometimes you just have to try new things out...plus i wanted to aim towards xbox deving and i have to agree with you...C# is an insult thats why im back in good ol C++ ^^
Ehh.. I'm playing with XNA because I'd like to make something for the xbox, but otherwise it doesn't offer enough control and isn't the type of thing you'd use to make games that run on Mac and Linux.
I made something similar about two months ago, to communicate to a server and control robots. It was quite an experience. And I only crashed the robots' systems twice! : )
How would I add libws2_32.a to visual studios 2010? It's a linker file, yes?
I'm getting these weird errors that consist of " 1>Socket.obj : error LNK2019: unresolved external symbol __imp__socket@12 referenced in function "public: __thiscall Socket::Socket(void)" (??0Socket@@QAE@XZ)"
and whatnot
crypto9595 2 weeks ago
I got a question
I got the code and it works, and now I want to have that client window on an other laptop, for now I want a LAN connection but how can I do that?
I gave my both laptops their own IP adress, but my still can't find the host ;(
Do you know how to make that LAN network?
turbellob 3 months ago in playlist Favorite videos
Please show us a (or is it an?) UDP example!
grendel1980 4 months ago
I'm using winsock and it randomly puts winsock 2.0 with a bunch of smiley faces in the data i send............................... wtf
levijgraham 6 months ago
One thing I haven't gotten with Winsock, is getting it to run over a WAN. On my home network it ran fine., but I once tried to get it to work over internet, and it didn't work. Also file transfer is something I haven't gotten to.
zadeh79 7 months ago
What's the point of the SendData() function? It returns true - but it always returns true no matter if send() failed or not, why is it not checked?
if( send( ... ) != SOCKET_ERROR )
return true;
else
return false;
??? I have to say I first was positive about this tutorial and thought it was better than those out there in the internet but I get disappointed more and more..
mySaigaAntilope 7 months ago
@mySaigaAntilope It was pretty incomplete, yes. I'm sorry for the quality, it is quite old, and back then it was hard to get anybody to peer review my tutorials. Hopefully what I release in the future will be better quality, once I have time again to make tutorials (really busy w/ full time software engineering jobs since I've been out of college).
LusikkaMage 7 months ago
iostream? lol. I use conio and stdio
vitorix24 9 months ago
@vitorix24 So you're writing C code and not C++ code.
LusikkaMage 9 months ago
@LusikkaMage It's just libraries. C and C++ it's almost same thing. =D
vitorix24 9 months ago
@vitorix24 No no no no no no no. C++ is much more than an extension of libraries on top of C. C++ is a completely different language, and while C is compatible with C++, C++ is not compatible with C.
C++ is a multi-paradigm language, so on top of your basic C functionality it also includes Object Oriented designs as well as Templating.
Polymorphism, Encapsulation, Inheritance, all are parts of C++ that are not parts of C, and using C++ with only C functionality is a waste of the language.
LusikkaMage 9 months ago 14
@LusikkaMage ahhh... ok ok ok ... If you tell, it's true.
I'm studing Programming and Network at school , and i'm almost complete the first year. =D
thanks for asnwer :D
vitorix24 9 months ago
@LusikkaMage What's your thought on C99?
XFi6 7 months ago
@vitorix24 get your facts right ^^
Sintaxx2 7 months ago
You have a new subscriber. Congrats.
1dantheman100 10 months ago
thank you so much Lusikka. you help me for finishing my assignment in socket programming.. :))))
Basica30 11 months ago
thank you so much Lusikka. you help me for finishing my assignment in socket programming.. :))))
Basica30 11 months ago
Thank u
Master =P
dida1891 1 year ago
Very useful thanks :)
tofurocks99 1 year ago
hey i am learning game programming and stuck how a server handles connections
Anddos25 1 year ago
thanks man
xXChinesXx 1 year ago
i have Dev-C++ and i have debug error:
"Build Error, sample, Error 1"
Please help
Romop5 1 year ago
Been looking for 3 days... think this will be what helps me create my own working socket program. Much love.
subfuzion 1 year ago
*V£Ry•CoOL™
Mr47MasoN47 1 year ago
nice video, but you shouldn't use a namespace in a header file
sandorlev 1 year ago
ALT+P-> Linker Settings -> Compiler Settings (on the left) -> "Dev-C++/lib/libws2_32.a"-> ok
Andrew3726 1 year ago
Very Easy:
Click on Project Options or STRG + P, then in the Tab Linker settings, on the left click "add" or so.
Then you select your linkfile ("Dev-C++/lib/libws2_32.a") and click ok
Very easy^^
Andrew3726 1 year ago
Awesome videos lusikkamage. One small problem though. When I try connecting to another computer via IP address, I'm still able to type messages and send them but the other computer doesn't seem to be recieving them. Any ideas why? Tried playing about with firewall but to no avail :(
iammoose 1 year ago
please, how can I link libws2_32.a in Dev-C++ ?
Romop5 1 year ago
how i can link the dll in visual c++ 2008?
barbxxx94 1 year ago
This tutorial gave a good start for me, thx a lot.
nikasSnapsas 1 year ago
Socket programming is almost in a league of its own. I use the Windows API regularly and anytime I look at Winsock functions, they seem to be very different.
0121ryanh117 2 years ago
it never ceases to depress me how little i know.
Ratstail91 2 years ago 18
Don't worry, compared to someone else, we ALL know barely anything =D
I've been programming and developing Internet programs for years, but I've ALWAYS wished I knew how to program and do 3d graphics rasterization and rendering like John Carmack or even Ken Silverman; but I just don't have the time (or the patience) ='P
TAz69x 2 years ago
know it alls have been known to forget it all
part2themovie 2 years ago
I downloaded the code and tried to compile in Dev and it didn't work
ElectrifiedJelyZebra 2 years ago
Nor when I did it in code blocks..
ElectrifiedJelyZebra 2 years ago
A very nice example, though the dots and the : are very hard to notice.
However, the project files are uploaded and many thanks for that. It's very hard to to program with sockets, hard to understand..
However, winsock does not work with linux, the two library's are very similar but you should have included that in this tutorial. Programming for 1 O.S. just isn't the way to go.
Xorifelse 2 years ago
Nice one.. thnks!!!
alwaysakil5 2 years ago
This tut includes everything, thanks for it :D
HordeAreMyFatCousins 2 years ago
Thank you for this tutorial, I am working on a multi-player game in C++ but I have been struggling a little with WinSock, this really helped me! I have subscribed!
ZepplinProgramming 2 years ago
Was looking for socket tutors, Thank You Lusi!
Using std in your code just doesn't sound right anymore...
noobay 2 years ago
I've been looking for a c++ sockets video, thank you Lusikka.
I wanted to give you a cookie, but I eated it!!
damasta00138 2 years ago
You bastard! D:
Jk!
Thanks. ;D
LusikkaMage 2 years ago
Is there any way to remake this console chat program to a chat program with GUI?
LTUGang 2 years ago
Yeah, but if you don't already know how to create a GUI in C++ you should probably research that first, either using Visual Studio's tool, something like wxWidgets, or writing your own with Allegro/SDL.
LusikkaMage 2 years ago
I know how to create a GUI, but I think I can't use blocking sockets in GUI, so what can you offer? Maybe Async? I've been googling for sockets in GUI using C++, but there are many tuts using VB - not C++.
LTUGang 2 years ago
I don't know very much about sockets and such, when I used it for a game I was working on I used blocking sockets, but my program was multithreaded so it'd run the socket stuff on a separate thread.
LusikkaMage 2 years ago
So maybe you know where I can find a good tut about thread and socket programming because I don't know what thread is ;D Thanx
LTUGang 2 years ago
If you're familiar with SDL at all, Lazy Foo's tutorial site has multithreading intro stuffs.
LusikkaMage 2 years ago
nice, thanks for this tutorial. I have been socket programming in C# and I am starting to move onto C++ now. It is really hard for a 15 year old though, are you self taught? or did you go to school?
HordeAreMyFatCousins 2 years ago 5
I have gone to school for CS, though I haven't taken their socket course. I learn some through school, I learn some through the internets.
LusikkaMage 2 years ago
@HordeAreMyFatCousins Why dod you assume a 15 year old? From the voice i think it's a woman with quite a lot of knowledge about programming. No pun intended at all.
I could be wrong though.
farmdve 9 months ago
@farmdve She's a 23-years-old female, as you can see in her profile.
But anyway, i have to see i saw the tutorial relative to this video, in written text.
TommyVSGH 8 months ago
you can use threads.
With Qt for example...
megalomania345 2 years ago
This is very nice of you to take time out to help beginners. It would be very cool to see you take it further - maybe make a game lobby then once all clients are connected switch to UDP for the main game - but only if your not too busy :-P
TheMrSion 2 years ago
Is there any way to remake this program in a chat app like skype? I mean that you would be able to write another message right after the first one, that you don't have to wait for a message from another user.
LTUGang 2 years ago
This has been flagged as spam show
you can do all you want!
Kryomega 2 years ago
One thing I want to know... you may be able to answer my question.
If I write a client and a server in C++ and that I want the client to call functions that are on the server, how do I do that?
Is it something as much retarded as a switch/case to know what function I want to call using the parameters I sent from the client?
I hope you can guide me :(
o0PinKFisH0o 2 years ago
yea thats the way
Kryomega 2 years ago
thanks i really wanna learn this
MasterMind300 2 years ago
noticed your mouse pointer is sorta scary :D
FusionNinjin 2 years ago
It's the cursor from Psychonauts (Raz's hand) that I ripped and made into my cursor, heh.
LusikkaMage 2 years ago
well your a very good coder, iam just starting to learn c++, and its easyer than i tought it would be, and its sorta giveing me insight of all those games i used to play.. its quite interesting realy :)
FusionNinjin 2 years ago
where we can find this code plzzzz
zinnzcasseur 2 years ago
Description.
LusikkaMage 2 years ago
whee!
onix9009 3 years ago
Wheeeheeeeheeee!! :D :D :D
LusikkaMage 3 years ago
cool video (:
blitzkid123 3 years ago 3
Hey lusikk!
I have a question...
I want to start learning about this kind of stuff (Online apps) because I want to make an Online game in the future. What should I learn? Should I stick with winsock? Or maybe search for another Networking Lib?
aldex123 3 years ago 2
If you're game is going to be something like a MUD, you will need to know 3 things, through and through.
1. Standard C++ Syntax
2. Winsock API (for server and client)
3. Multithreading(so asynchronous connections).
lostm0ments 2 years ago
is winsock available for linux
burgert10 3 years ago
No, but there are just plain sockets. They're pretty similar, just google.
LusikkaMage 3 years ago
just use the standard c++ decompiler plz
i hate codeblocks
CoolFurby 3 years ago
How about I use whatever I want to use?
That sounds better to me.
LusikkaMage 3 years ago
Must be that time of month again...
Yea really... VC08 should be used... Or is it too complex for you?
netsoj 3 years ago
Kind sir, VC08 is a Microsoft product. I prefer to use stuff that is open source, because that's more of what I stand for.
I also stand for blocking idiots posting on my channel. :)
LusikkaMage 3 years ago
DANG female programmer , that never happens! Good to see!
amino0o 3 years ago
Good tutorial. Why did you give a direct refrence to the lib? With codeblocks using GCC You can just as easly type ws2_32 and it will find it by scanning your dir's
loringenator 3 years ago
Do you find code blocks is good to create apps with?
SaihatAlhaq 3 years ago
I like it.
LusikkaMage 3 years ago
What compiler is this?
SaihatAlhaq 3 years ago
Using Code::Blocks
LusikkaMage 3 years ago
sadly ive decide to back down from allegro and SDL and decided to do DirectX 9...then recently(now) im doing XNA C# ...its extrememly OOP but still awesome ;)
mouseroot 3 years ago
C# is an insult to programming......
So let me get this straight...
You started w/ C++ and Dx9
then you 'upgraded' to C# to XNA...
Yes that makes sense...
netsoj 3 years ago
well sometimes you just have to try new things out...plus i wanted to aim towards xbox deving and i have to agree with you...C# is an insult thats why im back in good ol C++ ^^
mouseroot 3 years ago
i wud have to say c# makes all things c easier... lovin c# and xna
uoftcosmik 2 years ago
Ehh.. I'm playing with XNA because I'd like to make something for the xbox, but otherwise it doesn't offer enough control and isn't the type of thing you'd use to make games that run on Mac and Linux.
LusikkaMage 2 years ago
I think you're an insult to programming, guy. Stop flinging your shitty opinions around and attacking me and my subscribers.
I'd say fuck off, but you really don't have a choice as you're blocked now. :P
LusikkaMage 3 years ago
wow lol
Daltonn0810 3 years ago
yee who ventures into the land of winsock will either perish...or come out an hero!!!
freaking Win Tutorial
mouseroot 3 years ago
Har! I do not know the meaning of "perish"!
There's no way I can back out of this now that I've announced to my class that I'm going to be doing a multiplayer winsock game in C++. XD
More complex tutorials to come as I learn more and have time.
LusikkaMage 3 years ago
So this is what you've been up to...
I made something similar about two months ago, to communicate to a server and control robots. It was quite an experience. And I only crashed the robots' systems twice! : )
ROLLANDandCOLORS 3 years ago 2