« first day (806 days earlier)      last day (4146 days later) » 

3:00 AM
C:\Users\Korisnik\Documents\Desktop\Server\main.cpp||In function 'int main()':|
C:\Users\Korisnik\Documents\Desktop\Server\main.cpp|48|error: invalid cast of an rvalue expression of type 'SOCKADDR* {aka sockaddr*}' to type 'SOCKADDR_IN& {aka sockaddr_in&}'|
||=== Build finished: 1 errors, 0 warnings (0 minutes, 0 seconds) ===|
 
ok, it's a pointer.
 
so SOCKADDR_IN*
 
which you failed to state.
 
what is a pointer?
socketName is a struct, not a pointer
 
inet_ntoa(((SOCKADDR_IN&)socketName).sin_addr)
not according to your compiler
 
3:01 AM
o.O
that one worked
 
int x = 0; int* p = &x; is a pointer @Tuntuni.
 
mmhumm.
 
@Jeffrey Yeah, but i made a SOCKADDR object and was trying to cast it to SOCKADDR_IN
 
@Tuntuni your welcome.
 
@johnathon Ah, sorry, thanks! ;)
Although, what does SOCKADDR_IN& mean
 
3:03 AM
@Tuntuni, I'm sorry then, I don't know what you'r talking about.
 
@Jeffrey No problem. :D
 
it means you casted the SOCKADDR* to a SOCKADDR_IN reference, which would allow you to use the . operator to access it's members
you could have used a SOCKADDR_IN* , but you'd have to use -> to access it's members inseted.
 
SOCKADDR socketName; is the declaration. why does my compiler thing it is a pointer?
think*
 
@Tuntuni dunno, i'd have to see your whole code
 
@johnathon okay, 1 second.
the structures are part of the winsock API
i've been messing with them for the past couple of hours
 
3:07 AM
what time is it there where you guys live?
 
4:07 am
 
@Tuntuni, what are you in Italy?
 
@Jeffrey Croatia, the next country to the right. ;)
couldn't give up on these sockets when i just started to get the hang of it
 
Maybe I could make my own forwarder!
Here we go...
 
@Tuntuni, I've been there this summer. Pretty nice country but I wouldn't go there again...
 
3:09 AM
@Tuntuni i know where there from, winsock is one of the areas im rather familiar with
@Tuntuni SOCKADDR socketName = {};
getsockname(server, &socketName, sizeof(SOCKADDR));
cout << "Connection received from: " << inet_ntoa(((SOCKADDR_IN&)socketName).sin_addr);
 
@Jeffrey why not? :)
 
user1182183
http://stackoverflow.com/questions/14087937/is-there-a-custom-language-add-in-for-visual-studio-2012-vs11
Well knock yourself out :P
 
user1182183
and if you want to complain about PAWN please read this first.
 
user1182183
:P
 
@johnathon oh getsockname takes sizeof(SOCKADDR)?
didn't realise that .. thanks ;)
@johnathon is the = {} necessary?
 
3:11 AM
@Tuntuni, I've seen some problems with my group of friends there. Some serious stuff: people wanting to kill themselves. For the rest there are good people as far as I know.
 
@Tuntuni yes.. and yes.
 
@Jeffrey o.O oh well :P where have you been to?
@johnathon since the second one is yes, does = {} init the whole struct to 0 or something else?
 
@Tuntuni thats exactly what it does.
 
@johnathon mhm i see. and if i did = {0} would that only init the first element to 0?
 
no, all other elements guaranteed zero
 
3:13 AM
and what about arrays?
 
I figured it out! FUCK YEAH!
 
@ThePhD congratulations, variadic templates?
 
@johnathon Mmmmmmmmmmmmmmmhmmmmmmmm.
 
@ThePhD Rock on.
@Tuntuni the reason you use sizeof on a struct, is so that the call your passing your struct to doesn't write off the end of it, which would cause a rather nasty bug in the executable.
 
@Tuntuni Just so you don't get confused by DeadMG, if you did = {1} only the first element would be 1, the rest would be zero.
 
3:17 AM
@Tuntuni, Omis.
 
@Tuntuni the winsock calls are all C api's, so keep that in mind when working with them.
 
@johnathon mhm. do you have any sites to recommend to get more familiar with the winsock api? except the msdn though, already using that one
@Rapptz thanks
 
Tits.
It doesn't work.
 
happens. :/
 
std::forward<>'s arguments get immediately destructed after the call, so the std::array of argument pointers failures.
It shouldn't be reconstructing, if it's perfectly forwarding, but...
 
3:20 AM
@Tuntuni the best reference i know in existence to the Winsock api is ... lemme go get it..."Windows Sockets Network Programming" by bob quinn and dave shute, both were on the winsock proposal committie that implimented the api to begin with.
@Tuntuni , it's published by addison wesley
 
@johnathon thanks, i'll take a look at that. i feel like the information about the API is scattered around the internet and it takes a while to collect and organize everything in your head. :S
 
@Tuntuni how deep into the sockets api do you want to get?
 
@johnathon well as deep as possible, would come in handy in the future too.
 
@Tuntuni because winsock is a lot larger of an api surface than i feel you may realise
 
I'll go, see ya tomorrow...
 
3:22 AM
bye
 
@Jeffrey have a good one man
 
@Jeffrey Later!
 
@Tuntuni how deep are you into the win32 api?
 
@johnathon currently i'm trying to make a simple irc bot to get some experience
so i'm on getaddrinfo, socket, connect, etc. stuff like that
 
@Tuntuni right. Well as soon as you want to use asynchronous calls, you'll have to have enough of an understanding of the win32 api to make a simple window, the MSDN has a rather exellent tutorial on the matter if you'd like i'll dig around and find it for you
@Tuntuni and keep in mind there is more than one paradigm of asynchronous socket calls, all the way down to IO completion ports
 
3:26 AM
@johnathon oh i'm familiar with the win32 api. dialogs, windows, etc. the thing that confuses me are the winsocks
 
@Tuntuni ok, well a bit of advice, do NOT use blocking socket calls inside a window
 
@johnathon haha yeah ;) happened to me before
 
@Tuntuni and if you do have a window, i recommend WSAASyncselect()
 
what does WSA stand for? WinSock API?
 
@Tuntuni yea
@Tuntuni it's a winsock 2.0 call
 
3:28 AM
ya
@johnathon lots of the code i find on the net is UNIX only or something?
 
@Tuntuni berkley sockets.. which will work with winsock 1.0
@Tuntuni theres a few subtle differences, but nothing major to overcome
 
@johnathon i see. right now the only thing i use from the WSA is the Startup and Cleanup. the rest of the calls are connect, getaddrinfo, etc. should i use something else instead?
 
@Tuntuni it's not a bad thing to know the berkely socket stack, as that's where winsock got half of it's backbone from, it's just that windows has much better concepts of how to handle network io
@Tuntuni yes, when you move out of the console and into a windowed application you'll want to use the async getadderinfo api, and set your sockets to async select, so that it'll notify you of it's states, after you set the socket to async all the rest of the calls are the same on the socket, such as send , recv, ect.. but their non blocking insted of blocking.
 
user142019
Is there a function that is the same as flip (.)?
 
@Zoidberg'-- std::swap()
 
user142019
3:32 AM
Swapping is unrelated to function composition.
 
then yes there is but you won't find one in the Standard lib
 
@Zoidberg'-- haskell? .. are you asking about haskell?
 
@johnathon mhm. thanks for the tip
 
@Tuntuni np
 
user142019
@johnathon of course.
 
3:34 AM
@johnathon how long have you been working with the WSA?
 
@Tuntuni windows 95 ish
 
@johnathon nice! :)
@johnathon could you take a quick look at this and tell me if you would consider this code good/safe? ideone.com/MKIxQF
 
@Tuntuni sooner or later your'll want to learn cryptography as well... as you'll be using it a lot wtih network traffic
 
@johnathon hehe that is true. i'm familiar with a bit of it like AES, RSA, MD5, etc. not much though.
 
@Tuntuni yes, from what i can see it's safe, but way C style..
 
3:37 AM
@johnathon how would you improve it?
 
@Tuntuni with a class... like.. what are you trying to make the code to do, you mentioned Irc?
 
@johnathon oh ya it is in a class. i just pulled a chunk of code
want me to post the whole thing?
 
@Tuntuni sure
 
@johnathon thanks for your time. ;) 1 second i'll be absent for a couple of minutes. have something to do.
 
@Tuntuni np.
 
3:39 AM
@DeadMG I might need your help here. I'm trying to figure out how to make sure that the arguments I have are run through the potential gamuts of conversion to be the proper type. I thought using std::forward might be the solution, but it's destructing any temporaries created to be used after std::forward exits from itself, e.g.: stacked-crooked.com/view?id=e774331f1ead21ac5536cfb62b9ee085
 
@ThePhD um.. if im not wrong... which i may be.. but like, remove the address of operator from infront of std::forward
 
I do not want to create additional copies unless the argument is not of the proper type.
However, I can't create an array of references, so I'm trying to do it VIA pointers.
 
@ThePhD std::foward returns an r value reference, no copies are made
@ThePhD use a vector....
 
Hm. Maybe a vector can do the trick.
Let's find out.
... Blargha.
No initializer_list support in VS for constructing vectors. x_X
Let's hack some in...
 
here they are
http://ideone.com/2pnBSV
http://ideone.com/QuieCA
http://ideone.com/rCkFWZ
 
3:46 AM
@ThePhD ... should be easy to do
@Tuntuni yea, move WSAStartup to the constructor of the class, and WSACleanup to the destrutor.
 
thephd
you are definitely doing it wrong
next time I get a break from the action here I will tell you
 
@Tuntuni then your connect call should only have to do name/host lookup, and connect...
 
Wow this episode of MusicForProgramming has got pretty creepy
 
@johnathon mhm. will do.
 
@Tuntuni that way you can make your own version of a send() that will accept what ever data type you want and you can do a lil easy hand marshelling to a socket's send()
 
3:47 AM
"Bleed out." "Bleed to death" eerie music plays It's 3:45am
 
@johnathon what if the init fails. how would i "return false"?
 
@Tuntuni throw .
@Tuntuni this is c++... we have exceptions..
 
@johnathon hah yeah, don't use them too much. i'm somewhere in between C and C++. switching over to c++ ;D
 
What did you work on before?
 
@Tuntuni and honnestly, ive' yet to see WSAStartup fail if you manage to give it a sane version request
 
3:49 AM
@johnathon hehe easy to say when you have experience :D
@johnathon what do you think about the code overall? would you improve something?
 
@Tuntuni a lot.. i'd use a lot more C++ and a lot less char*
@Tuntuni and the ZeroMemory macro .. needs to go.. initalize your structure with {}
 
@johnathon ok
 
@DeadMG :c Okay...
 
@Tuntuni and the getaddrinfo returns an array to adderess info stucts
@Tuntuni you'll want to index into those at index 0
@Tuntuni WELL, dosnt return, but passes out by last paramater
 
@johnathon ya and there's a next ptr in the struct right?
 
3:53 AM
@Tuntuni honnestly i'd have to crack the book and look,
 
@ThePhD Firstly, if std::forward's parameter is not directly based on a template parameter, you are extremely definitely doing it wrong.
 
@johnathon i think that's what i read
 
@Tuntuni my gut says no though
 
@johnathon haha :)
 
std::forward perfectly forwards arguments based on their type- if the type is invariant std::forward will never have any effect
 
3:55 AM
Okay...
 
@Tuntuni yea , it does. And it returns a linked list, use it.
@Tuntuni thats a newer winsock api btw.
@Tuntuni supposed to replace gethostbyname()
 
@johnathon yup, read that part :)
 
@Tuntuni OK, well be aware of that if you want to run on anthing pre win2000
 
@johnathon if the WSA is written mostly (fully?) in C, is it a good idea to use the c++ stl, etc?
 
@Tuntuni yes. it is a good idea.
 
3:58 AM
@johnathon yeah i've decided that the min requirement is at least win2000
 
@DeadMG This technically does what I want: stacked-crooked.com/view?id=4d00bd63d670ae41e55d6ec5497ed6dc
 
oh yeah
 
But I don't want it to make a copy of every single parameter.
 
if you want to get an error if you pass the wrong type
 

« first day (806 days earlier)      last day (4146 days later) »