TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ben erasmus
NA
4
2.1k
Socket - Gobal IP address
Mar 24 2014 10:42 AM
Im trying to connect to a pc using the gobal IP address. If use the local IP address my code works fine. As soon as I start to use the gobal ip address it timesout.
Can someone help me please.
My local IP address is
192.168.1.101
and gobal IP is: 41.132.43.220
Here is my code:
TcpClient socketForServer ;
bool
status =
true
;
//41.135.31.49
//192.168.1.105
socketForServer =
new
TcpClient
(
"192.168.1.101"
,
8100
) ;
Console.
WriteLine
(
"Connected to Server"
) ;
NetworkStream networkStream = socketForServer.
GetStream
() ;
StreamReader streamreader =
new
StreamReader
(networkStream) ;
StreamWriter streamwriter =
new
StreamWriter
(networkStream) ;
string
clientmessage=
""
;
string
servermessage=
""
;
while
(status)
{
Console.
Write
(
"Client:"
) ;
clientmessage = Console.
ReadLine
() ;
streamwriter.
WriteLine
(clientmessage) ;
streamwriter.
Flush
() ;
servermessage = streamreader.
ReadLine
() ;
Console.
WriteLine
(
"Server:"
+servermessage) ;
}
streamreader.
Close
() ;
networkStream.
Close
() ;
streamwriter.
Close
() ;
Reply
Answers (
0
)
Display List in windows forms application
c# timer error