Posts Tagged ‘Simple’

Hi I A Writting Simple Server Client Socket.the Code That I Have Written Is Not Working.please Anyone Help Me?

Friday, January 15th, 2010

#include
#include /* Basic I/O routines */
#include /* standard system types */
#include /* Internet address structures */
#include /* socket interface functions */
#include /* host to IP resolution */
#include
#define portno 6789 /* default port of host */
void error(char *msg);
int main(int argc, char *argv[]);
void error(char *msg)
{
perror(msg);
exit(1);
}
int main(int argc, char *argv[])
{
int serversocket;
int newsockfd;
int clilen;
char buffer[4096];
struct sockaddr_in serv_addr, cli_addr;
/*portno = 80;*/
int n;
serversocket = socket(AF_INET, SOCK_STREAM, 0);
if (serversocket < 0)
{
error("ERROR opening socket");
}
bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = INADDR_ANY;
/*portno=atoi(argv[1]);*/
serv_addr.sin_port = htons(portno);
printf("Socket has port #%d\n", serv_addr.sin_port);
if (bind(serversocket, (struct sockaddr *) &serv_addr,
sizeof(serv_addr)) < 0)
{
error("ERROR on binding");
}
listen(serversocket,5);
while (1) {
clilen = sizeof(cli_addr);
newsockfd = accept(serversocket,(struct sockaddr *) &cli_addr, &clilen);
if (newsockfd < 0)
{
error("ERROR on accept");
}
/*n = read(newsockfd,buffer,sizeof(buffer)-1);
printf("A connection has been established\n");
if (n < 0)
{
error("ERROR reading from socket");
}
printf("Here is the message: %s\n",buffer);*/
n = write(newsockfd, buffer, sizeof(buffer)-1);
if (n < 0)
{
error("ERROR writing to socket");
}
close(newsockfd);
}
return 0;
}

:ook Its Simple I Cant Create A 2nd Mail Address. What Can I Do? If I Have To Drop Yahoo As My Isp Then I Will

Friday, December 25th, 2009

I cannot CREATE a second e mail address. I want to create a 2nd address. The sys stops me every time with an error msg. I have just created a 2nd verizon address with same name, what can I do???

Visual Basic 2008 Simple Help Please :)?

Sunday, September 20th, 2009

Ok ime Kinda good with visual Basic but
Ime haviing trouble installing Winsock thats
mswinsck.ocx its how you can create connections in visual basic
I have downloaded it And i dont know how the hell to intall it If i try open it says windows cannot find the program to open it i seen something like you have to run it With a command next to it but it didnt work :S maybe i did it wrong idk
ime on windows vista Basic :)
Please help Thanks alot

Python How To Sort A List (why Am I Getting This Error) Simple.?

Tuesday, August 18th, 2009

I am trying to sort a simple list and get it in order. My script is as follows:
import sys
import operator
a = [5,7,4,2,6]
a.Sort()
print [a]
and I get this error:
AttributeError: ‘list’ object has no attribute ‘Sort’
Anyone know whats up? I’m using python 2.6.1
Thanks…

Can Someone Please Explain .ocx’s And .dll’s To Me In Relatively Simple Terminology? Thanks?

Tuesday, July 21st, 2009

Alternatively, if you can think of any websites for me to look at that aren’t Wikipedia I’d be just as grateful.