Showing posts with label Network Programming. Show all posts
Showing posts with label Network Programming. Show all posts

Thursday, January 24, 2019

Host, IP Address, and Port Number In Computer Networking, Socket Programing, and Distributed Applications

Host Computer Network Socket Programming
Example of A Host In A Computer Network


Host

We must have a sound understanding of a few networking concepts before we start writing a network application’s code. We’ll start with the term Host.

More than 65% discount on network & socket programming courses:




A host is a fancy term for any computing device connected to a computer network.
This machine can be a laptop, a smartphone, your home router, Amazon Alexa, or a server running in the cloud.
A machine is called a host for a reason.
It is called a host because "it is hosting a software which can communicate over the network."

Every host on a network is accessible through a unique address within that network.
This address is called Internet Protocol Address, or IP Address for short.

 A few examples of IP addresses are given below. It is written in dotted decimal notation.
We’ll learn more about the IP address in the next video.

IP Address

In this video, I’ll explain what an IP address is. IP Stands for Internet Protocol.
V is for version.
IP Address UDP and TCP IP Socket Programming IP V4
IP V4 In Computer Networks

At present, IP V4 is the most widespread IP protocol.
Another version of IP specification is IP V6, which is catching up these days.
An IP V4 address is a group of 4 different 8-bit numbers.
The total length of the IP Address is 32 bits.
An individual number inside the IP Address can have a value between 0 and 255
When printing an IP address, the four numbers are separated by a dot to make reading easier.
This method of printing the IP address is called the dotted decimal notation.
In many cases, a hostname is used instead of an IP address.
A hostname gets translated into an IP address by a Domain Name Server, a.k.a DNS.

The Port(Number)




More than 65% discount on network & socket programming courses:
https://www.udemy.com/udpsocketprogramming/?couponCode=HALFPRICE

https://www.udemy.com/tcpip-socket-programming-for-coders-using-csharp-net/?couponCode=HALF

In order to understand port numbers, we will use an analogy.
Let’s consider that your PC is like an apartment building.
This building can be reached through a specific street address.
In the case of a PC, it will be the IP address.
This building is further divided into apartments, where every apartment is identified by a unique apartment number.

Port Computer Networking Socket Programming EndPoint System Ports
This apartment number is similar to the port number.
The computer contains a large but finite number of ports.
Each apartment in this building is occupied by only one thread or process.
Only one thread or process can send or receive data from a port number.
When we need to send data to a specific thread or process, we need to know which port number it is using.
We also need to know the PC's IP address on which the thread or the process is running.
The combination of an IP address and a port number is known as an EndPoint.
A few examples are shown on the screen.
There are total of 65536 ports on a computer.
Port numbers from 0 to 1023 are reserved for operating system usage.
These apartments are occupied by the building administration.
 These are called well-known ports or system ports.
A few examples are port 20 is used for FTP(File Transfer Protocol).
Port 23 for telnet and port 25 for emails using SMTP(Simple Mail Transfer Protocol).
And port 53 for DNS(Domain Name Server).

You don't need to learn C# to work on this course.

Socket Java, python socket udp

More than 65% discount on network & socket programming courses:

Thursday, November 16, 2017

Interesting discussion about TCP/IP Socket Programming Course Online

Couple days ago I received a message on Udemy about my course titled "TCP/IP Socket Programming for Coders and Students". The message was sent by a student of mine.
It highlighted important points about the course. I'm afraid if I'll leave it in the inbox, I will lose it. That's why I'm putting the exchange here. It will not only be more permanent, I'm sure it is going to help a lot of other people as well.

If you find the topic interesting, you may watch the full course for only $10 here:
https://www.udemy.com/tcpip-socket-programming-for-coders-using-csharp-net/?couponCode=HALF

TCP/IP Socket Programming in C# .Net for Coders and Students - Online Course at Udemy

Naeem, I haven't left a review yet, mostly because it was going to be 2.5 star review with some some pro's and con's. My suggest, add a GUI for the Client using windows forums. Showcase how to perhaps send a file to each other, and how to message one another. Client to Client (PM), Client to room full of folks ect. The course has some really nice points also, especially working with the Pub / Sub elements. While I have used YouTube to gain some great insight into this very topic, I didn't really see anything to justify paying for this, or using free YouTube videos that cover the same elements plus more. I will say you did fantastic with the pace of the videos, and your voice was easy to understand compared to other instructors. I have taken countless udemy videos and can say that you did great. I will not refund this course, because I would really love to see add the different elements, and bridge away from the console application into windows forums. I think you will find more folks paying for this because of your teaching ability, and the fact it has more then what you can get on YouTube. View some YouTube videos and see how much they show you, they even show APIs, Use of SSL, Delegates, Events, and much more. Just want you to have some honest feedback before I leave a review in a couple of days.
17 hours ago
Dear Charles, Many thanks for taking the time to write the message. I’m glad that you reached out. I used a console application on the client side for a reason. I believe we can better illustrate the benefits of asynchronous programming in a console application. Please note that we’re creating a class library project, it is very easy to reuse it in a WinForms, WPF, or Windows Service application. Building a class library was a deliberate move. Adding lectures showing how to send a file has been on my ToDo list for a while. I will be publishing videos on this topic sometime soon. The pub/sub model already covers firing and handling events, I just tried to keep it to the point because the course has already become fairly large. I think explaining delegates would be redundant. I’d love to dig deep into SSL and add that to the mix too, that’s a very good idea which didn’t cross my mind. Someone once said that I don’t teach anything about security in the course, somehow my mind couldn’t connect it with SSL. Please elaborate further on this part of your sentence “they even show APIs”. YouTube videos can be a good source for learning, but there are certain advantages of curated content which is why course markets like Udemy are flourishing. I personally take every comment, message, and rating very seriously. These things impact instructor revenues. I try my level best to improve the quality of my content. Over the past two years I’ve (luckily) learned a lot about video making and invested a significant amount of Udemy earnings into equipment & training. People generally don’t do this on YouTube. You can see that I completely revamped the course this year. The old course videos are still present as deprecated sections for reference purpose. Quality of new videos is 100% better than the old ones IMO. At the present, I am working on a new course about UDP socket programming in C#. It will come out in December, most likely. A few students talked to me about packet data analysis, maybe I’ll produce a course about that sometime next year. But since TCP/IP course is already doing well, that’s why adding new content to fortify it will be my top priority. I’ll be adding more content to this course as soon as I’m done with the UDP one. You reserve the right to take a full refund, no hard feelings. You are free to rate and review the course as you please, no hard feelings again. Although it would be nice if you could hold back a 2.5 start review until after Black Friday. That will help me with the sales. The course just recently reached a 4.5 rating which is a big deal. But, it’s your choice. Please feel free to talk back, share ideas, discuss issues, and ask questions. I’d love to interact, help, and be helped. Sincerely, Naeem Malik.
11 hours ago
Please elaborate further on this part of your sentence “they even show APIs”. This for example the client would send a token to the server to connect, and if the token is wrong then they would be refused connection. I should have said token based authentication not API sorry. I will not refund the course because you did do a great job, just left me with a lot of gaps to try and figure out. I will be taking your UDP course so get that up ASAP, i'm building a game in Unity and I want to make my own server to handle the calls. This is why I took your course, and I feel that I could make the in game chat server with what I have covered here. I viewed this course months ago with the old videos, the only reason I grabbed it this time is because the work you did revamping them all. You slowed it down to a point folks could not only follow along, but understand you. So really great work there, and always no better way to invest then into yourself. That's why I'm here taking courses learning, and trying to invest in myself as well. I would add file transfer, ssl, token system, and how to send a file two and from. I will keep this course because I feel that you will be adding more, and I want to support that. I don't like to leave negative reviews especially when I see that someone has put alot of work to make the content, and to make it clear. So no worries that's why I messaged you, and I have refunded a few courses because they were just terrible. Based on our conversation here, I will be leaving a review. One quick help question if you have time. I would like to have client / server not to share the same event args. Because smart folks exist, and can view the source code of the client to mimic the calls to the server. When you reference the event args to the client project, it compiles the server code as well for the client. Hope that you can understand what I'm trying to say lol.
a few seconds ago
Hi, I searched for SSL in C# yesterdauy, came to know that it is fairly simple. Take a look at this please: https://msdn.microsoft.com/en-us/library/system.net.security.sslstream(v=vs.110).aspx The "Remarks" section is good and the examples are useful. I'll distil it into video form in 2018. Here's how to transfer a file: https://msdn.microsoft.com/en-us/library/sx0a40c2(v=vs.110).aspx I didn't think from a reverse engineering perspective, but it helps to have security baked right into the architecture. Thanks for the EventArgs suggestion. Many thanks for your help. Stay in touch. Regards, Naeem.
You don't need to learn C to work on this course. Socket Java, python socket udp

Friday, July 10, 2015

Network Programming course offered by AIOU in BCS programme is wonderful

AIOU-BCS-COURSE-OUTLINE-NETWORK-PROGRAMMING-3487
Network Programming 3487 in list of  BCS courses of AIOU 


I am an Allama Iqbal Open University graduate, I passed BCS in 2005. I've been working as a programmer ever since, although I've changed track a few years ago and moved to automated software testing. I must say Open university has got a very good program in place and if someone's got a fire in their belly, AIOU has got the gasoline to turn it into an inferno. It has produced bright stars like my friend & colleague Akhter Sheikh.

AIOU Network Programming course code 3482

You can check the detailed curriculum of the course here

http://www.aiou.edu.pk/CourseDetail.asp?CID=171&PID=187

This course is using Winsock 2 with VC++ which is not commonly used in the market these days. I suppose using C# .Net instead would have been more beneficial for the students, because it is a widely used programming language.


aiou-network-programming-3482-course-details
Course outline of network programming course







Inclusion of advanced topics like IOCP and QoS is a good move, it will help students to get jobs in software development market.


An online video course about TCP/IP socket programming

Network programming course on AIOU website came to my attention one day while I was casually browsing list of courses included in their bachelor of computer sciences program these days.
My online course about TCP/IP socket programming is hosted on Udemy.com and it can be helpful for people who are either taking this course right now or have taken the course some time in past already.
I have created a free discount 100% coupon for my junior university fellows. You don't pay anything, just click the link given below and watch the stuff. I'm sure it will be worth your time.

The first section of the course explains several important computer networking concepts which are used for socket and network programming. These concepts are universal, which means useful for C++/C#/Java/Python or any other programming language.
The remaining parts of the course show practical coding examples and programming techniques which are useful in general.


Join my online course, its FREE!

I recommend you to sign up for my online course and take a peek, it is totally free(using the link below) and you will get a wealth of information in two hours. Just click the link below!


Udemy Discount Online Learning Course Socket Programming

Asynchronous Socket Programming in C#




Prologue: How I got into network programming?

Before I became automated software testing professional, I luckily had a chance to do network programming in more than one language. I started in C# .Net for a telephony server application that used TCP/IP sockets to share data between a Panasonic POTS PBX (Microsoft TAPI 2.1) and various clients. Later on, I used Winsock in a C++ based project. I even used POSIX sockets for a short project while working with an Alcatel Lucent IP PBX(CSTA).

I had no idea back then that in the years to come I will be using sockets again and again. I used UDP sockets in Java programming language for an Android remote control app(iSymphony 2.1), that was some time in 2012/2013. User data gram sockets are considerably different as compared to connection based TCP/IP sockets.
You don't need to learn C to work on this course.

Socket Java, python socket udp

Thursday, February 12, 2015

Network Programming Interview Questions C#.Net


  1. Which namespaces are used for TCP/IP network socket programming in C#.Net? Answer: System.Net and System.Net.Sockets
  2. An object of System.Net.Sockets.TcpListener will be used to listen for incoming connection requests. Answer: True
  3. Once we call the method TcpListener.Start, our TcpListener object starts handling incoming connection requests. Answer: False
  4. Which class is used to represent a callback or delegate method? Answer: AsyncCallback
  5. IAsyncResult.AsyncState contains the original TCPListener object which was passed as parameter to BeginAcceptTCPClient method call. Answer: True

  6. The Windows ____ can stop your code from using network, you better disable it for a while. Answer: Firewall
  7. An object of which class is used to handle client communication? Answer: TcpClient
  8. NetworkStream.BeginRead method will return data in ____ array. Answer: byte
  9. TcpClient.Client represent an object of which type? Answer: Socket
  10. Encoding.ASCII.GetBytes is used to convert text to bytes in order to send it over network. Answer: True
  11. A TCP/IP socket server needs to perform following network operations. Answer: Listen for incoming connections, send data to clients, receive data from clients.
Learn more about Socket and network programming in C# .Net in my Udemy course:
TCP/IP Socket Programming For Coders & Students 





Demo TCP/IP Sockets Read and Write in C#, Free Udemy Course from Naeem Akram on Vimeo.

Friday, November 14, 2014

Interview Questions on Socket Programming

Socket programming is used to make computers exchange data. It is an uncommon topic and not many programmers come across it in their professional career.
This blog post outlines several questions which might be asked from someone in an interview for a position that involves either writing code for network applications or managing a team of people writing network programming code.

The questions listed here are worth reading and knowing the answers to these questions in general means you have a sound top level understanding of computer networks work.

It is possible to learn network programming in only one hour, just take the Udemy course given below,

https://www.udemy.com/tcpip-socket-programming-for-coders-using-csharp-net/#/

1. A host is a machine that is hosting a software capable of communicating over the network. Yes/No?
2. A host is identified by an IP Address which is unique inside a network. Yes/No?
3. In enterprise scenarios, a host name is translated into an IP address by a server called:

  1. DHCP Server
  2. DNS
  3. LDAP Server
4. An IPV 4 IP address is a group of __???__ numbers, each 8 bit in size with a value between 0 to 255.


Demo TCP/IP Sockets Read and Write in C#, Free #Udemy Course, 100% discount from Naeem Akram on Vimeo.

5. We find the IP Address of our computer using a DOS command which is

  1. tracert
  2. ipconfig /all
  3. ipconfig /flushdns
Quick TCP/IP Socket programming for coders is a free course (limited time offer), take the course and learn about socket programming in only one hour.

https://www.udemy.com/tcpip-socket-programming-for-coders-using-csharp-net/#/

6. Every computer contains a finite number of ports which is

  1. 1024
  2. 65536
  3. 99999










7. The client process and the server process must be running on two different machines.
8. A pair of an IP address and a port number is used by the server process to listen for incoming connection requests, this pair is called an __???__

9. A client processes's attempt to connect with a server process can fail for various reasons including


  1. Windows firewall has blocked the client process or server process from using the network.
  2. Server IP address supplied to the client is wrong
  3. The server process is not started at all
  4. All of above


10. Telnet is a free utility, it is always enabled on every PC. Yes/No?
11. We will enable Telnet __???__ from the "Add Remove Programs" dialog "Turn Windows features on or off"

https://www.udemy.com/tcpip-socket-programming-for-coders-using-csharp-net/#/
Only one hour is all you need to know answers of the questions listed here and get loads of more interesting information about computer networks. The course link given above is free for a limited time, it won't cost you anything and you will learn loads of new stuff so just go ahead and sign-up.

Friday, January 30, 2009

More on TCP/IP streaming Sockets

tcp-ip-streaming-sockets-diagram

I was writing server side code which will be reading commands from a client over a Win32 socket, problematic code was like this

// suppose m_sock is a working socket, all we gotta do is start receiving data on it

const int nBuffSize = 256;
int nRecv = 0;
char * szCmdBuff = new char [nBuffSize];
memset(szCmdBuff, 0, nBuffSize);
while(1){
nRecv = recv(m_sock, szCmdBuff, nBuffSize, 0);
// do something with the data
memset(szCmdBuff, 0, nBuffSize);
}

Problem created by this code: Junk values in input.
Solution: do memset right before calling recv

Exact code to refresh things goes like this

while(1){
memset(szCmdBuff, 0, nBuffSize);
nRecv = recv(m_sock, szCmdBuff, nBuffSize, 0);
// do something with the data
memset(szCmdBuff, 0, nBuffSize);
}

TCP IP sockets are the foundation rock of http protocol, which is the core of internet today. Having a solid understanding of how TCP/IP sockets work is essential to solve network communications problems.

cheers all...

Mistakes, not to be forgotten

Socket Programming:

Was writing a socket server few days back. The code was not working, it goes like(omitting error checks)

SOCKET g_sock_server;
g_sock_server = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
bind(g_sock_server, (LPSOCKADDR) &g_addr_server, sizeof(g_addr_server));
listen(g_sock_server, SOMAXCONN);

SOCKADDR_IN addr_cli;
SOCKET s_cli;
int nSize = 0;
s_cli = accept(g_sock_server, (LPSOCKADDR)&addr_cli, &nSize);
if(s_cli == INVALID_SOCKET) return;
// rest of the code... say blah blah blah blah

The method accept will always return INVALID_SOCKET, guess why?

because of

int nSize = 0;

The fix is

int nSize = sizeof(addr_cli)

cheers all...