-
Notifications
You must be signed in to change notification settings - Fork 1
/
wcnetworks2log.txt
163 lines (163 loc) · 9.21 KB
/
wcnetworks2log.txt
1
<Guest20692> : it should be fine right?<ankit__> : Should be fine, who is it by the way? It shows me Guest20692<Guest20692> : Yash<Guest20692> : i donno y the nickname changes on its own<Guest20692> : -NickServ- You failed to identify in time for the nickname Yash<Guest20692> : tats the error it shows<adeepak> : Let everyone join<adeepak> : Siddhanth did you try the program?<siddhanth> : no, not yet. Still going through the tutorials. Will do it by tomorrow though.<adeepak> : Ok cool<yashguest> : hi everyone<Puneet> : hello<adeepak> : Puneet and samvid wanna talk about your experience with the programming<suhasbs> : Hi. Whens the session starting<yashguest> : yes plz puneeth n samvid, tell us abt it<Puneet> : I did it in c, it was tough in the beginning, all the random structures didn't make sense. But the site went through the code line by line, it made sense at the end.<yashguest> : nice<Samvid> : Same here<Puneet> : The site had explanation for almost every function it used. It took a lot of my time for me to understand.<adeepak> : Tell us about the functions you used<Samvid> : I followed a tutorial on youtube that gave each of the structure definitions<yashguest> : ya....i also read the structures and understood quite a bit,still hav to try n implement it<Puneet> : important functions were, socket(),bind(),listen(),accept(),read(),write()<Samvid> : Well, the first thing was to create a socket with the socket() function, then bind it with the bind(). The make the server listen on that socket using listen(). When a client connection has been made, accept it with accept()<Samvid> : And use send() and recv() to send and receive data<Samvid> : Guess read() and write() can also be used<Puneet> : but i still understand some of the things like why did we used 5 in the listen() function<adeepak> : We will come to that, first samvid what was the last argument ie flag you used in send recv<Puneet> : @Samvid, we can use send() and recv()?<Samvid> : Im not sure of that<Samvid> : I dont know the PF_INET and AF_INET parameters as well<Samvid> : @Puneet, yeah it seems so<adeepak> : Read write are send recv with flag 0<Puneet> : AF_INET is supposed to be Address Family for the server to be hosted in the internet?<adeepak> : Af inet is address family, to define the network address of socket<adeepak> : Pf inet was supposed to be protocol family, a subset of af but was not implemented<Puneet> : AF_INET doesnt really host it on the internet? <adeepak> : Someone asked me in mail about hosting on internet who was it?<Puneet> : Me, i think.<ankit__> : ok <ankit__> : so say your are connected to internet and you have an IP x.x.x.x<ankit__> : whoever can see that IP, can connect to a socket connected to it <ankit__> : that's why I said your socket will be surely visible in LAN <Puneet> : so, my ip is visible only to those on LAN?<ankit__> : Your IP will be mostly translated to a public IP of your ISP at your service provider gateway <ankit__> : so beyond that point you need to know your Public IP and port to connect, we will discuss these concepts soon <Puneet> : Oh, okay.<suhasbs> : Was implementing the same in java, but I did not use any of the functions like bind(), listen() as others have. Just used accept()<ankit__> : first back to your listen doubt <ankit__> : yea Java abstract most of the functions <suhasbs> : Oh. Ok<ankit__> : that's why I put C as the preferred language for everyone to get the basic functions <ankit__> : if you do same in python, you can open a socket in 1 line <ankit__> : so yea, What do you think is the work of listen? I mentioned something in my mail <ankit__> : I am connected right?<sh__> : yea<Puneet> : connected to the port? yea i think<ankit__> : ok so yea what do you think is the work of listen?<Samvid> : listen() is to wait for incoming connections?<Puneet> : yea that.<ankit__> : yes <ankit__> : listen in itself implements something similar to a forking <Samvid> : forking as in fork() that is used to create a new process?<ankit__> : you make your socket listen to a port, when a connection comes in, the server allots a new port for communication and goes back to listen at the initial fork simultaneously <suhasbs> : One thing I didnt understand was , when we use accept(), does that run(or wait) on another thread until the connection is established?<ankit__> : accept will always run on a different thread <rahul-kumi> : PING Mr_OSI <rahul-kumi> : PING 1481656196165<ankit__> : connection will get another <suhasbs> : OK<ankit__> : 5 in listen just means it will allow 5 connections <Puneet> : oh okay.<ankit__> : apart from these you would have come across hton<suhasbs> : So, first we have to run the server side program to open the port and then run the client side program??<ankit__> : yes otherwise client won't have anything to connect to <suhasbs> : Oh ok. Thats why it was giving errors.<ankit__> : no one came across hton?<Puneet> : its host to network right? the port numbers were converted to something else<ankit__> : yes <Samvid> : Its to convert between endianness?<Samvid> : If the processor of the server supports little-endian storage, its used to convert it to big-endian?<ankit__> : yes it is used to normalise the representation <ankit__> : also how many of you faced problem in restarting server on same port?<Samvid> : me<Puneet> : me, i guess coz we didnt close()<Samvid> : Even SO_REUSEADDR and SO_REUSEPORT didn't work<Puneet> : whats that? those are arguments to socket()?<ankit__> : if you don't close properly it won't work, you can reuse only if it's free <ankit__> : what else are the doubts in this?<Samvid> : @puneet: its a value given to sin_addr.s_addr<Puneet> : i didnt get what the constant INADDR_ANY represented<Puneet> : ah ok, @Samvid.<ankit__> : during bind?<Puneet> : yea<ankit__> : it just prevent you from binding your socket to a specific IP address and hence you socket can accept connection from any IP address <Samvid> : @ankit: So all this BCD sockets right? How does it differ from others, say WinSock for example? I know WinSock is used on Windows, but how does it vary when it comes to coding it?<ankit__> : otherwise say you are connected to two network, hence you have two IP, if you bind your socket to one of these, it won't work for connections from other IP <ankit__> : These are BSD sockets <Samvid> : BSD* my bad<ankit__> : I am not sure about WinSock, but there is a new socket in market with some very cool functionalities, its called zmq sockets <ankit__> : the functionality of sockets changes with the implementation <ankit__> : like the socket program which you wrote was a request response socket<Samvid> : Oh<ankit__> : BSD functionality is limited to it <ankit__> : ZMQ allow publish-subscribe and push pull along with request response <ankit__> : You see Mr_OSI in user list?<Samvid> : Oh, okay<Samvid> : Yeah<Puneet> : yea, he is supposed to be a bot right<Samvid> : You coded it to log the chats?<ankit__> : yea its a simple client socket program connected to IRC server, it connects and listens to all the convo <Samvid> : oh cool<ankit__> : If all doubts regarding client socket are done, we will move forward?<Puneet> : yep<Samvid> : yup<ankit__> : everyone try implementing it<ankit__> : I sent a second mail regarding basics of layers <ankit__> : I will start with layer 3 and layer 4, if time permits we will come back to layer 2 <ankit__> : layer 1 and layer 5 are beyond the scope of this mentorship <ankit__> : cool?<Samvid> : alright!<Puneet> : okay<ankit__> : so first thing is layer 3 are IP addresses <ankit__> : Internet uses 2 kind of IP- IPv4 and IPv6 <ankit__> : whats the structure of IPv4 address?<Samvid> : x.x.x.x?<ankit__> : do you know the range of x?<Samvid> : and 0<= x <=255?<ankit__> : right so how many bits are that <suhasbs> : 8<Puneet> : 8<Samvid> : 8<ankit__> : so what will be the size of a IPv4 address?<Samvid> : 32 bit<ankit__> : and how many IP addresses are possible?<suhasbs> : 2^32<Samvid> : 256^4<suhasbs> : same thing!<Puneet> : :D<Samvid> : yeah yeah :P<ankit__> : 4,294,967,296<ankit__> : so what do you think how big is that number?<Puneet> : its small compared to the number of devices present in the whole world<suhasbs> : less than population of India?<ankit__> : yea <ankit__> : since 1980, IPv4 address exhaustion was a big question in networks<ankit__> : the number of devices increase so much that IPv5 became insufficient before it was launched <ankit__> : and then IPv6 was launched <ankit__> : 340,282,366,920,938,463,463,374,607,431,768,211,456<ankit__> : thats the number of IPv6 addresses <Puneet> : okay...128 bits<Puneet> : IPv5 was 64 bits?<ankit__> : I don't know, find out :P<Puneet> : ok<ankit__> : so like last time I will end session with an assignment <ankit__> : 1) find out about IPv4 address classes and classless IPv4 address <ankit__> : 2) write the algorithms for NAT and DHCP in your language <ankit__> : we will again discuss about them in beginning of next session <ankit__> : cool?<Samvid> : alright<ankit__> : I will send mail regarding these <ankit__> : I prefer you guys to find out and then discussing cause it makes session less boring for both of us <ankit__> : see ya guys, I will here for sometime in case of doubts