Commit 7194b9d507c41fb61ed6e52ff901a49dc273198b

Authored by Imanol-Mikel Barba Sabariego
1 parent dc242cfe

git-svn-id: svn://imanolbarba.net/PAD@57 c2ee353e-ed0d-4329-bf56-03aec153487f

JChatClient/bin/client
No preview for this file type
JChatClient/src/Socket.cpp
@@ -27,7 +27,7 @@ void Socket::Create() @@ -27,7 +27,7 @@ void Socket::Create()
27 throw SocketException ( "TCP: Could not create socket" ); 27 throw SocketException ( "TCP: Could not create socket" );
28 } 28 }
29 setsockopt(sock,SOL_SOCKET,SO_KEEPALIVE,&optval,sizeof optval); 29 setsockopt(sock,SOL_SOCKET,SO_KEEPALIVE,&optval,sizeof optval);
30 - setsockopt(sock, SOL_TCP, TCP_NODELAY, &optval, sizeof optval); 30 + setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &optval, sizeof optval);
31 } 31 }
32 32
33 void Socket::Bind(string address, int port) 33 void Socket::Bind(string address, int port)
@@ -35,7 +35,7 @@ void Socket::Bind(string address, int port) @@ -35,7 +35,7 @@ void Socket::Bind(string address, int port)
35 sockAddr.sin_family = AF_INET; 35 sockAddr.sin_family = AF_INET;
36 sockAddr.sin_port = htons(port); 36 sockAddr.sin_port = htons(port);
37 sockAddr.sin_addr.s_addr = inet_addr(address.c_str()); 37 sockAddr.sin_addr.s_addr = inet_addr(address.c_str());
38 - if(bind(sock, (struct sockaddr *)&sockAddr, sizeof(struct sockaddr)) != 0) 38 + if(::bind(sock, (struct sockaddr *)&sockAddr, sizeof(struct sockaddr)) != 0)
39 { 39 {
40 stringstream sstream; 40 stringstream sstream;
41 sstream << "TCP: Could not bind to address " << address << " on port " << port; 41 sstream << "TCP: Could not bind to address " << address << " on port " << port;
@@ -186,4 +186,4 @@ const Socket&amp; Socket::operator &gt;&gt; ( std::string&amp; text ) @@ -186,4 +186,4 @@ const Socket&amp; Socket::operator &gt;&gt; ( std::string&amp; text )
186 message = NULL; 186 message = NULL;
187 } 187 }
188 return *this; 188 return *this;
189 -}  
190 \ No newline at end of file 189 \ No newline at end of file
  190 +}
JChatServer/bin/pad/prac2/Connection.class
No preview for this file type
JChatServerV2/bin/pad/prac2/Connection.class
No preview for this file type
JChatServerV2/bin/pad/prac2/MySocket.class
No preview for this file type
JChatServerV2/src/pad/prac2/MySocket.java
@@ -37,7 +37,7 @@ public class MySocket extends Socket @@ -37,7 +37,7 @@ public class MySocket extends Socket
37 try 37 try
38 { 38 {
39 output = super.getOutputStream(); 39 output = super.getOutputStream();
40 - input = new BufferedReader(new InputStreamReader(super.getInputStream())); 40 + input = new BufferedReader(new InputStreamReader(super.getInputStream(),"UTF-8"));
41 } 41 }
42 catch(IOException ioExc) 42 catch(IOException ioExc)
43 { 43 {