Easy but Powerful Network Programming Software

iCoder and upRedSun's network programming software was made to be easy ... but powerful. Using Network Programming Gear, easily and automatically build tcp-based or udp-based network protocol source code for client/server sides. pure platform independent c source code to make sure highly performance and windows,linux and unix platform are all supported.auto protocol struct diagram to help protocol design.platform independent c source code and platform independent network programming library to support all fix or variant length binary protocol and TLV is supported too.

Network Programming Gear Pro
network programming
Auto Generate Code
Generate Demo Code
TLV Support

Network Programming Gear Enterprise
network programming
All Pro Version Function
Source code of independent socket library

 

What is network programming and what is our software for?

Network programming , can be called socket programming. In most of cases, our computer software can not finish your task alone, it need to communicate and collaborate with others softwares to completely done your task. For example, when you play online game, your game that run on your computer must communicate with the game server, so this way you can fight or collaborate or talk with others players. Another easy example is "surfe internet". When you surfe internet, your browser must communicate with the website server by using HTTP protocol. Network programming inside all of the softwares. So Network programming is a very important technology.

Normally, the two sides that need to communicate must follow some protocol. This is the way that the two sides can know each other what trying to say. The protocol maybe is the standard protocol or just your custom protocol.

Now we can just start a easy and example custom protocol to see what is network programming like.

The example is about instant message client software, like MSN. When you run the instant message software, the first thing need to do is login the server. Then maybe your instant message software can download the buddy list from server. When you close the instant message software, the last thing to do is just logout from server. Normally, a protocol need to define a header to indicate the whole length of network packet and a verb to indicate what this network packet for. Then the protocol need to define the body according to the verbs in header. In our case, the header and body like this:

Header

length integer(4 bytes) indicate the whole length of network packet
command integer(4 bytes) indicate what the network packet for. In our case, include two verbs, login and logout. so we define login:0x1; logout:0x2

 

body(login)

username string(20 bytes) the username need to be used to login server
password string(20 bytes) the password need to be used to login server

 

body(logout)

Since we just want to logout from server, we don't need to tell any info to server. So the logout body could be empty.

By following the protocol we define, the code of client side will like this:

-------------------------------------------------------------------------------------------------------

int our_socket;

our_socket = socket(AF_INET,SOCK_STREAM, 0); // create network socket for network communication

struct sockaddr_in server;

memset(&server, 0, sizeof (server));

server.sin_family = AF_INET;
server.sin_addr.s_addr = inet_addr ("127.0.0.1"); // 127.0.0.1 is the ip address of instant message server
server.sin_port = htons(1234); // 1234 is the listen port of instant message server

connect (socket, (struct sockaddr *)&server, sizeof(server); // try to connect to the server

char buffer[1024];

memset(buffer, 0, sizeof(buffer));

//here we need to encapsulate the network packet

int cmd_login = 0x1;

memcpy(buffer+4, &cmd_login, 4); // encapsulate into the field command

strcpy(buffer+8, "test"); // encapsulate into the field username

strcpy(buffer+28, "password"); // encapsulate into the field password

int length = 48;

memcpy(buffer, &length, 4); // the last thing to do is encapsulate the length of network packet.

//then we call send function to send the network pakcet to server side

send(our_socket, buffer, 48, 0);

-------------------------------------------------------------------------------------------------------

 

The code of server side will like this:

int our_socket;

int client_socket;

our_socket = socket(AF_INET,SOCK_STREAM, 0);

struct sockaddr_in servaddr;

struct sockaddr_in clientaddr;

int size = sizeof(clientaddr);

servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(1234); // the port is the server will listen
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);

bind(our_socket,(struct sockaddr *)&servaddr,sizeof(servaddr));// bind socket

listen(our_socket,100); // listen on the port 1234

client_socket = accept(our_socket, (LPSOCKADDR)&clientaddr, &size); // wait client connect into

//now we have a client connect into

//we need to call the function read to read network packet

char buffer[1024];

memset(buffer, 0, sizeof(buffer));

recv(client_socket, buffer, 48,0); // read 48 bytes from socket. this is the whole length of network packet. here is just an example. actually, we need to read the firt 4 bytes from socket, then we can tell the length of the network packet

//then according the buffer we read from socket, we need to parse the buffer to know what is the verb, and then we know the is a login packet. then we can extract out username and password.

-------------------------------------------------------------------------------------------------------

 

This is the basic steps that we network programming. But actually, network programming is more complex. When the fields in header or body are not fixed length, they are variable or tlv type. This will make your work hard to do. And you still need to care about bytes order, socket programming, or the platform you based on is linux, or windows. You need to care about a lot of stuff.

Now with our software Network Programming Gear, you just input the fields in header and body, and then just click "generate", you will have the independent c source code, it can run under windows, linux and unix system. And the performance is very greate. You don't need to care about the details about network programming. This is what we software value for. It will turn network programming more easy.

 

 

Testimonial:

network programming

Need Help?
Contact us