File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes Socket/TCPIP help required Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Socket/TCPIP help required" Watch "Socket/TCPIP help required" New topic

Socket/TCPIP help required

Tiger Scott
Ranch Hand

Joined: Mar 01, 2001
Posts: 223
I have to open a socket connection to a server using the providers documentation. Can somebody help translate it in Java for me. This is what the documentaion has:
myaddr=(socket structure){AF_INET,wsport,myIPAddr)
apiaddr=(socketaddr structure){AF_INET,SERVER_PORT,serverIPaddr)
wsport= a unique client port
myIPAddr= client IPAddr
SERVER_PORT,serverIPaddr- known
fd- definition of socket connection
Thanks a lot,
Peter den Haan
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
To me it looks like this is just opening a TCP socket connection to the server -- i.e. you can simply instantiate a, get the input- and/or output stream and off you go.
- Peter
Tiger Scott
Ranch Hand

Joined: Mar 01, 2001
Posts: 223
You mean just open a Socket with:
Socket(String host, int port, InetAddress localAddr, int localPort)
Mirza Galib

Joined: Jun 02, 2002
Posts: 12
open a socket with:
Socket soc = new Socket("",3333) ;
get the stream

Input Stream = soc.getInputStream());
There is also a catch in it
they are also asking to bind it
They could also be talking about a ServerSocket
Syntax for it is
ServerSocket ser = new ServerSocket(3333);
Socket soc = ser.accept();

Accept method will return the value of incoming socket in the form of socket.

"Hain aur bhee duniya mein sukhanwar bahut acche.<br />Kehte hein ke Galib ka hai andaz-e-bayaan aur."
I agree. Here's the link:
subject: Socket/TCPIP help required
It's not a secret anymore!