Hello guys i'm trying to send data to same socket at different times from different java classes. I can easily send the data from one class but after logging in when i try to send data to same socket from another java class ,there is an error. suggest me some solution

Could you please show us the error?

One approach would be creating a class to handle networking and simply sharing that object between all your classes. That class would manage the sending and receiving of the messages. You would probably need to create a way for each object to ask the class if messages had arrived for it.

You'll probably want to thread the networked side of the application.

can u please show me in example?

let me explain u guys. I had a login class from where i make a connetion to a socket through some port and then i have another class called CHATPANEL from where i want to send message to same socket and port from Login class without making any new connections. How can i do this any help will be appreciated :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.