Commit 3cede1cd authored by Heiko Liermann's avatar Heiko Liermann
Browse files

- bugfix

parent c73fde8d
......@@ -3,7 +3,7 @@
#include "Socket.h"
int main(int argc, char **argv) {
int fd, done = 0, stdinOpen = 0;
int fd, done = 0, stdin_open = 0;
fd_set rset;
struct sockaddr_in server_addr;
ssize_t len;
......@@ -35,7 +35,7 @@ int main(int argc, char **argv) {
select(fd + 1, &rset, NULL, NULL, NULL);
//0 ist lesbar, also wenn von stdin was lesbar ist
if (FD_ISSET(0, &rset) && stdinOpen == 0) {
if (FD_ISSET(0, &rset) && stdin_open == 0) {
//lese von stdin
len = read(0, (void *) buf, sizeof(buf));
//solange lesen bis stin zuende ist (Strg+D )
......@@ -43,7 +43,7 @@ int main(int argc, char **argv) {
if (len==0) {
//lese stdin
shutdown_wrapper(fd, SHUT_WR);
stdinOpen = 1;
stdin_open = 1;
}
else
//sende
......
......@@ -19,7 +19,7 @@ main(int argc, char **argv)
memset(&server_addr, 0, sizeof(server_addr)); //socket address structure
server_addr.sin_family = AF_INET;
server_addr.sin_addr.s_addr = htonl(INADDR_ANY); //specify the IP address allows the server to accept a client //connection on any interface,
server_addr.sin_port = htons(13); //port 13 daytime server
server_addr.sin_port = htons(strtol(argv[1], NULL, 10));
bind_wrapper(server_fd, (const struct sockaddr *)&server_addr, (socklen_t)sizeof(server_addr)); //(2)The bind() function shall assign a local socket address address to a socket identified by descriptor socket
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment