Showing posts with label Win32 Sockets. Show all posts
Showing posts with label Win32 Sockets. Show all posts

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

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...