Help! How do I get Java sockets to work in Windows 2000?

T

Thundaran

I'm writing an STMP program that need to connect to an MX server. My
code works fine from a Unix machine, but I need to run it from Windows:

InetSocketAddress address = new InetSocketAddress(server,
25);
Socket socket = new Socket();
socket.connect(address, 5000); // connect with 5 second
timeout

When I run my java program in the command prompt I get this error
message.

java.net.ConnectException: Connection timed out:

How to I get this socket to work?
Do I have to create a bridge between a Java Socket and a Windows Socket?
 
Z

zero

I'm writing an STMP program that need to connect to an MX server. My
code works fine from a Unix machine, but I need to run it from Windows:

InetSocketAddress address = new InetSocketAddress(server,
25);
Socket socket = new Socket();
socket.connect(address, 5000); // connect with 5 second
timeout

When I run my java program in the command prompt I get this error
message.

java.net.ConnectException: Connection timed out:

How to I get this socket to work?
Do I have to create a bridge between a Java Socket and a Windows Socket?

firewall?
 
T

Thundar

I'm trying to get the sockets to work, I dont care about third party
firewalls. *sigh* I think this is the last time I turn to google msg
boards for help.
 
M

Mel O'Drama

Thundar said:
I'm trying to get the sockets to work, I dont care about third party
firewalls. *sigh* I think this is the last time I turn to google msg
boards for help.

Try using telnet to connect to your server from Windows....
telnet server 25

Or just configure your mail client to connect to the server. That at least
should tell you if there's something other than your code that's stopping
you reaching the server.
 
H

hamiltonca

Make sure the host name resolves. Try using just the IP address.
DNS name lookup or NIS name lookup could be the problem. Using the IP
address will rule this out.
Open a cmd window and try pinging the server.

Run the program and in a seperate cmd window use the command
netstat -ni|more and look for the server's IP address, the state of the
socket will show you what is going on with your socket connection.
 
L

Luc The Perverse

Thundar said:
I'm trying to get the sockets to work, I dont care about third party
firewalls.

I think what people are trying to say is that connecting maybe a problem on
the OS level and have nothing to do with your code.

Grab another mail client not previously installed on the system, run it and
verify it connects and you will have eliminated the possibility that it is a
firewall/network/hardware issue and established that the computer is capible
of connecting to the server.

Often times you will find that when there cannot possibly be a mistake with
the piece of code you are trying to fix, that you are right, there isn't a
mistake with it.

*sigh* I think this is the last time I turn to google msg
boards for help.

Try usenet instead, it allows you to quote who you are replying to so people
don't get confused.
 
R

Roedy Green

I'm trying to get the sockets to work, I dont care about third party
firewalls. *sigh* I think this is the last time I turn to google msg
boards for help.

People can't help you if they don't understand your problem. "getting
sockets to work" is to broad.

You CAN'T ignore the problem of firewalls when you use sockets. That's
one reason why they are not more widely used. You can temporarily
ignore the problem by using a pair of machines on the same LAN without
a firewall between them.

This is not a Google message board. This is a newsgroup. Google is
only one way, and not a very good way, of using it. See
http://mindprod.com/jgloss/newsgroups.html
 
N

Nigel Wade

Thundar said:
Windows 2000 doesn't have a firewall

The firewall would be on the SMTP server, or between your W2k client and the
SMTP server. It's a possibility that the SMTP server has been setup to only
allow connections from certain clients, and a firewall is one simple way of
achieving this.

As someone else suggested, test the connection using telnet.
 
A

Alan Krueger

Thundar said:
I'm trying to get the sockets to work, I dont care about third party
firewalls. *sigh* I think this is the last time I turn to google msg
boards for help.

Usenet is not Google Groups, though Google Groups participates in and
archives Usenet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top