Q: Using memset function in UDP socket I have a UDP socket which my client sends an array of integers to the server and the server receives it and store it as a variables. This is happening in an infinite loop. I didn't use any memset function for the buffering in the server side. 
I checked the results on the sever side and everything is being received correctly. 
I was wondering if its necessary to use memset at each iteration where I have the recvfrom() function... 
Servercode:
#define BUFSIZE     10
#define SERVERPORT    "9090" 
int main(int argc, char **argv) 
{
struct sockaddr_in serveraddr4; /* server's addr */
struct sockaddr_in clientaddr4; /* client addr */
struct hostent *hostp4; /* client host info */
int sockfd4; /* socket */
int portno4; /* port to listen on */
socklen_t clientlen4;
char *hostaddrp4; /* dotted decimal host addr string */
int optval4; /* flag value for setsockopt */
int n4; /* message byte size */
sockfd4 = socket(AF_INET, SOCK_DGRAM, 0);
portno4 = atoi("8080");
optval4 = 1;
setsockopt(sockfd4, SOL_SOCKET, SO_REUSEADDR,(const void *)&optval4 , sizeof(int));
bzero((char *) &serveraddr4, sizeof(serveraddr4));
serveraddr4.sin_family = AF_INET;
serveraddr4.sin_addr.s_addr = htonl(INADDR_ANY);
serveraddr4.sin_port = htons((unsigned short)portno4);
int b4=bind(sockfd4, (struct sockaddr *) &serveraddr4, sizeof(serveraddr4));
clientlen4 = sizeof(clientaddr4);
int buf4[BUFSIZE];

int A;
int B;
int buf4[BUFSIZE];


while(1)
{

    int n4 = recvfrom(sockfd4, buf4, BUFSIZE, 0,(struct sockaddr *) &clientaddr4, &clientlen4);
    A=buf4[0];B=buf4[1];
    cout<<A<<"  "<<B<<endl;

}
} 

