File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes How to connect to WIFI with the help of java(sockets)? 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 "How to connect to WIFI with the help of java(sockets)? " Watch "How to connect to WIFI with the help of java(sockets)? " New topic
Author

How to connect to WIFI with the help of java(sockets)?

Jitendra Kumar Jain
Greenhorn

Joined: Jun 28, 2011
Posts: 17
Hi Coders,

Actaully iam a new to the socket programming... I want to connect to the WIFI.. WIFI is assigning some dynamic IPS.. So my concern is how to connect to the ethernet ports and how it is assigning these ports.. Please help..
Satya Maheshwari
Ranch Hand

Joined: Jan 01, 2007
Posts: 368
Does the server have fixed address (as in , the domain name)? If yes, you could explore, http://www.dnsjava.org


Thanks and Regards
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41511
    
  53
Sockets are concerned with *where* to connect, not how to connect. Are you saying that you have more than one network interface, and you want to connect using a particular one? I don't think Java code can do anything about that, you'd need to set this at the routing level.

The dnsjava library -while cool in itself- can't help with that.


Ping & DNS - my free Android networking tools app
Jitendra Kumar Jain
Greenhorn

Joined: Jun 28, 2011
Posts: 17
I agree with you guys.. But the problem is that I know the WIFI is connecting the access point on my pc.. But how would i know which port it is using ? How do i listen to that port? Or is there any library in Java that helps in finding the port the ethernet is using..
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Let me ask a question to get some context information: why do you want a connection? What do you want to do with that connection?


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Jitendra Kumar Jain
Greenhorn

Joined: Jun 28, 2011
Posts: 17
I need to read and write data from the ethernet ports.. how can i do this?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41511
    
  53
Now I'm confused. In the title you said that you want to connect through the Wifi, but now you're saying you want to connect through Ethernet? Which one is it? And *why* is it important to use one over the other? Desktop PCs (which is what I assume you're talking about) generally only let you have a single network connection anyway.
Jitendra Kumar Jain
Greenhorn

Joined: Jun 28, 2011
Posts: 17
Let me explain you the overall requirements.. I have one WIFI network and some hardware components that connects to these wifis.. Now these devices sends the data to NIC card and also my NIC is connected to this WIFI.. SO iam confused how the ports are allocated..? and how java is connecting to these ports...
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41511
    
  53
Sorry, still not clear - those "components" talk to the Wifi or the NIC card? Through what kind of connection - TCP/IP? And what do you mean by "how the ports are allocated"?

What is the actual problem you're trying to solve?
Jitendra Kumar Jain
Greenhorn

Joined: Jun 28, 2011
Posts: 17
Thanks for the reply..

I was given an established product that communicates with WIFI.. I have a PC with WIFI enabled.. They also have their own hardware components(connected via WIFI) that communicates and pushes the data to the NIC.. Now the NIC and WIFI enabled on the same PC. So iam not clear how they communicates and which are the ports usually being used to read/write the data that the hardware components is sending.. Let me know if still it is unclear..
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41511
    
  53
A tool like Wireshark should tell you quickly what ports are being used.
 
Don't get me started about those stupid light bulbs.
 
subject: How to connect to WIFI with the help of java(sockets)?