Friday, September 30, 2011

struct timeval example

struct timeval example: ccplusplus.com









-----------------------------------------------------------------
See Also:
-----------------------------------------------------------------
-----------------------------------------------------------------

Blocking Socket


Blocking Socket Calls

A blocking socket will not return control until it has sent (or received) some or all data specified for the operation. It is normal for a blocking socket not to send all data. The application must check the return value to determine how many bytes have been sent or received and it must resend any data not already processed. It also may cause problems if a socket continues to listen: a program may hang as the socket waits for data that may never arrive. When using blocking sockets, special consideration should be given to accept() as it may still block after indicating readability if a client disconnects during the connection phase.

Essentially, all socket calls are blocking in nature. In other words, they do not return control to the calling code until they complete. Ordinarily, this wouldn't matter, except that in network programming in general, and socket programming in particular, most operations fall into one of two categories:

1.  they take time to complete
2.  they rely on a third party to complete

For example, the accept function call will block until there is a connection available to be accepted. While blocked, the call will not return, and subsequently, no more processing can take place, which is especially dangerous in a single threaded application.

See Also

non blocking socket

Setting a socket to be 'non-blocking' simply means that the library is instructed not to block when it is called. So, if accept is called on a socket, and there are no connections pending, rather than waiting for one, control will be returned to the calling block. To set a non-blocking socket, the ioctlsocket function is used, specifying FIONBIO as the parameter, and 1 as the argument.

See Also

Thursday, September 29, 2011

socket essential functions

Socket-Specific Functions


#include <sys/types.h>
#include <sys/socket.h>
int socketpair(int domain, int type, int protocol, int sv[2]);


#include <sys/types.h>
#include <sys/socket.h>
int socket(int domain, int type, int protocol);


#include <sys/types.h>
#include <sys/socket.h>
int bind(int sockfd, struct sockaddr *my_addr, int addrlen);


#include <sys/types.h>
#include <sys/socket.h>
int connect(int sockfd, struct sockaddr *serv_addr, int addrlen);


#include <sys/socket.h>
int listen(int s, int backlog);


#include <sys/types.h>
#include <sys/socket.h>
int accept(int s, struct sockaddr *addr, int *addrlen);

convert miles to Centimeter


See also
Other popular tricky C Sample Codes and language Concept.

convert miles to Inches


See also
Other popular tricky C Sample Codes and language Concept.

convert miles to feets


See also
Other popular tricky C Sample Codes and language Concept.

convert miles to meters


See also
Other popular tricky C Sample Codes and language Concept.

convert miles to kilometers


See also
Other popular tricky C Sample Codes and language Concept.

Wednesday, September 28, 2011

C++ Project : C++ Tutor


C++ Tutor
Version 1.0.0

Introduction
This introductory chapter provides an overview C++ Tutor, along with the hardware, software required for using it and the platforms on which it is supported.  

About C++ Tutor
This utility is a fun utility that is designed to learn C++ concepts in an interactive way like you are seeing in any of the good c++ websites. This utility explains all the C++ concepts with the example code also. These all come with user friendly option that are displayed as an option menu. See the screenshot below for that.

C++ Tutor Supported Platforms
   S.No
             Version
                                                Platform
     1
             1.0.0
All the Linux Systems like Red Hat based
     2
             1.0.0
All the UNIX systems like AIX, Solaris
     3
             1.0.0
Windows systems.

Note: The C++ Tutor supported platforms have no limit, all the required dependencies are shipped with the C++ Tutor. The platforms mentioned above are tested for this current release, and later with the new release they can be increased.

C++ Tutor Software Details
  1. C++ Tutor is written and developed using C/C++. It has all the ANSI standards that are applicable to C++.
  2. It is compiled under Linux with gnu GCC compiler version 4.1.2.
  3. Under windows it is build using Visual Studio 2005.
C++ Tutor Hardware requirement
C++ Tutor has a very less requirement. Under Linux it can run with any lowest combination. Under windows it can run with a minimum that Windows function properly. 

C++ Tutor Features
A Sample run is shown below. This is the help page design to see all the various tasks that this utility can do.

=====================================================================================
A development version of C++ tutor:

On expanding a menu:


Note: This is just a under development version. There are lots of the UI enhancement and additions are going on.
========================================================================================
Benefits of using C++ Tutor
C++ Tutor is a learning utility that can be modified by you. It has option that you can use to modify the tutor. Like if you want to add something your own concepts.

You can use this to learn all the C++ concepts, and carry with your email to any place in the word.

C++ Tutor Contact Support
You can reach for on demand demo and other related enquires @ projects@ccplusplus.com

Tuesday, September 27, 2011

getsockname example c


See Also

Monday, September 26, 2011

using struct tm in c


See also
Other popular tricky C Sample Codes and language Concept.