telnet session will connect, but I cannot communicate during session. I don't see the customized welcome message for each new accepted connection that is in the program. I type in the telnet window, but the program doesn't receive the message.
If I do
[cmd=]netstat -a[/cmd]
I see the Recv-Q with bytes of pending data, but Send-Q is empty. I executed different programming projects, from different websites, but same results. So I assume that my firewall settings are to blame.
[ see http://forums.freebsd.org/showthread.php?t=31340 -- Mod. ]
Please, any suggestions?
If I do
[cmd=]netstat -a[/cmd]
I see the Recv-Q with bytes of pending data, but Send-Q is empty. I executed different programming projects, from different websites, but same results. So I assume that my firewall settings are to blame.
[ see http://forums.freebsd.org/showthread.php?t=31340 -- Mod. ]
Please, any suggestions?
Code:
int status, socketFileDesc, newFileDesc, bytes_sent, len;
struct addrinfo hints;
struct addrinfo *result;
struct sockaddr_storage their_addr;
socklen_t addr_size;
char buff[4096];
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET; //IPV4
hints.ai_socktype = SOCK_STREAM; //TCP stream sockets
hints.ai_flags = AI_PASSIVE; //fills in local IP address automatically
getaddrinfo(NULL, "3490", &hints, &result );
socketFileDesc = socket(result->ai_family, result->ai_socktype, result->ai_protocol);
bind(socketFileDesc,result->ai_addr, result->ai_addrlen);
listen(socketFileDesc, BACKLOG);
strcpy(buff, "Hello Process \n");
while(1){
addr_size = sizeof(their_addr);
newFileDesc = accept(socketFileDesc, (struct sockaddr *) &their_addr, &addr_size);
len = strlen(buff);
send(newFileDesc, buff,len , 0);
}