Permalink
Browse files

define listen ip address

  • Loading branch information...
1 parent 2b9d0c2 commit c0be80b36f8f0ab2d9feb5c2225b9f16459780af @grobie committed Jun 10, 2009
Showing with 7 additions and 7 deletions.
  1. +7 −7 duoit.c
View
14 duoit.c
@@ -11,6 +11,7 @@
#include <arpa/inet.h>
#include <time.h>
+#define LISTENIP "127.0.0.1"
#define CPORT "3021" // the port users will be connecting to
#define DPORT "3020" // the default port for data transfering
#define BACKLOG 10 // how many pending connections queue will hold
@@ -467,7 +468,7 @@ int list_command(instruc *instruction, usr *user) {
*/
int passv_command(instruc *instruction, usr *user) {
char reply[26 + 18 + 7]; //#chars of standard reply + ip + #,
- char ipstr[INET6_ADDRSTRLEN];
+ char ipstr[INET6_ADDRSTRLEN] = LISTENIP;
char port1[4];
char port2[4];
char *ptr;
@@ -476,10 +477,10 @@ int passv_command(instruc *instruction, usr *user) {
struct addrinfo hints, *servinfo, *p;
int yes=1, rv;
- memset(ipstr, '\0', sizeof ipstr);
- memset(port1, '\0', sizeof port1);
- memset(port2, '\0', sizeof port2);
- memset(reply, '\0', sizeof reply);
+ // memset(ipstr, '\0', sizeof ipstr);
+ // memset(port1, '\0', sizeof port1);
+ // memset(port2, '\0', sizeof port2);
+ // memset(reply, '\0', sizeof reply);
//Create new d_socket we will listen on
memset(&hints, 0, sizeof hints);
@@ -520,7 +521,7 @@ int passv_command(instruc *instruction, usr *user) {
}
//save our IP-Address
- inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr), ipstr, sizeof ipstr);
+ //inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr), ipstr, sizeof ipstr);
freeaddrinfo(servinfo); //all done with this structure
@@ -580,7 +581,6 @@ int quit_command(instruc *instruction, usr *user, fd_set *master, usr **head) {
/*
* find the PORT of the user's socket
*/
-
int get_port(int sockfd) {
socklen_t len;
struct sockaddr_storage addr;

0 comments on commit c0be80b

Please sign in to comment.