How can i go about sending data to User A to user B?
lets say you can listen to a socket called:
wss://something.somedomain.some:8443/websocket
i can see the messages, send publicly in there, but what i wanna do is send From my end to another users end. From Client A to Client B.
Regards EngLen
DO NOT DEAL WITH THIS MEMBER
Look up the Socket class on MSDN and if that doesn't help then Google tutorials.
The server must support that, tons of ways to implement it, just look up some tutorials and if you get stuck feel free to ask.
Have a cool signature? hit me up and I might use it.
DO NOT DEAL WITH THIS MEMBER
Aug 20, 2017 12:16 AM
(This post was last modified: Aug 20, 2017 12:18 AM by DeadKube.)
Socket.send(data)
Socket.receive(data)
You're welcome.
Your server should basically hold a list of connected clients and send the appropriate data back to the appropriate client.
(Aug 20, 2017 12:16 AM)DeadKube Wrote: Socket.receive(data)
You can't simply just receive data, you need to listen. Often works by sending a request, then listening for a response from the ip you send the request to.
DO NOT DEAL WITH THIS MEMBER
Aug 20, 2017 10:35 AM
(This post was last modified: Aug 20, 2017 10:36 AM by 0xDEAD10CC.)
(Aug 20, 2017 04:53 AM)eithan1231 Wrote: You can't simply just receive data, you need to listen. Often works by sending a request, then listening for a response from the ip you send the request to.
Listening is for servers, OP is talking about 2 clients, which in this case client A would send, and client B would received, and the server as the man-in-the-middle would listen and send to the appropriate client(s)... Technically speaking he's correct. You would still have a receive loop to ensure that you read all of the data and future data however.
Aug 20, 2017 10:37 AM
(This post was last modified: Aug 20, 2017 10:41 AM by Trinity.)
(Aug 20, 2017 10:35 AM)0xDEAD10CC Wrote: Listening is for servers, OP is talking about 2 clients, which in this case client A would send, and client B would received, and the server as the man-in-the-middle would listen and send to the appropriate client(s)... Technically speaking he's correct, and you are wrong...
yeah, i couldent explain it that well, since i really know nothing of sockets but i actually wanna send it as me but make it come from another if that makes sense?
EDIT: and i do belive it is the wrong section since this is about Java.
Aug 20, 2017 10:47 AM
(This post was last modified: Aug 20, 2017 10:48 AM by 0xDEAD10CC.)
(Aug 20, 2017 10:37 AM)Trinity Wrote: yeah, i couldent explain it that well, since i really know nothing of sockets but i actually wanna send it as me but make it come from another if that makes sense?
EDIT: and i do belive it is the wrong section since this is about Java.
This is a Java project of yours? Why did you post in C#?
And no that doesn't make any sense, you want client <-> client rather than client <-> server <-> client?
DO NOT DEAL WITH THIS MEMBER
Aug 20, 2017 11:10 AM
(This post was last modified: Aug 20, 2017 11:16 AM by DeadKube.)
(Aug 20, 2017 10:47 AM)0xDEAD10CC Wrote: This is a Java project of yours? Why did you post in C#?
And no that doesn't make any sense, you want client <-> client rather than client <-> server <-> client?
Client to client connections are called p2p and would require a whole lot of work. I don't think OP is looking for that. Op please explain what you want in plain english. Do you want to make a custom client to make it look like you're someone else? If that's the case, any chat application with authentication capabilities will block you unless the server is vulnerable.
Java isn't really any different when it comes to sockets. You just send and receive and keep doing that until it's the end of the line. I coded a project like that once. I can send you the source in java code in exactly two weeks since I don't have access to my workspace. On holiday. Or wait just send me a pm with your email address and i might find it back. Keep in mind though that my particular java project was made in order to connect physical buttons to a server and once pressed they would notify an employee who has a smartdevice that is also connected to that server. It's not generic.
Aug 20, 2017 02:06 PM
(This post was last modified: Aug 20, 2017 02:07 PM by 0xDEAD10CC.)
(Aug 20, 2017 11:10 AM)DeadKube Wrote: Client to client connections are called p2p and would require a whole lot of work. I don't think OP is looking for that. Op please explain what you want in plain english. Do you want to make a custom client to make it look like you're someone else? If that's the case, any chat application with authentication capabilities will block you unless the server is vulnerable.
Java isn't really any different when it comes to sockets. You just send and receive and keep doing that until it's the end of the line. I coded a project like that once. I can send you the source in java code in exactly two weeks since I don't have access to my workspace. On holiday. Or wait just send me a pm with your email address and i might find it back. Keep in mind though that my particular java project was made in order to connect physical buttons to a server and once pressed they would notify an employee who has a smartdevice that is also connected to that server. It's not generic.
I know exactly what they're called, I purposely identified it as client-client so that OP could understand what I meant without doing any research. P2P is hardly any additional work - in fact probably the same as a server/client implementation, mainly because both sides need to be able to make a connection to any client, which means a client has some of the same functionality that a server would...
What the previous guy didn't understand is that a server does NOT listen for data, it listens for connections to accept them, and then receives incoming data. So he was wrong.
You wouldn't necessarily send/receive until the end of a line, that's for a chat client probably, but who's to say that a chat client can't send multiple lines in a single outgoing packet? What if the data in OP's case is binary data? All he said was "data from user a to b", which doesn't exclude sending executables, pdf's or anything similar.
(Aug 20, 2017 02:06 PM)0xDEAD10CC Wrote: I know exactly what they're called, I purposely identified it as client-client so that OP could understand what I meant without doing any research. P2P is hardly any additional work - in fact probably the same as a server/client implementation, mainly because both sides need to be able to make a connection to any client, which means a client has some of the same functionality that a server would...
What the previous guy didn't understand is that a server does NOT listen for data, it listens for connections to accept them, and then receives incoming data. So he was wrong.
You wouldn't necessarily send/receive until the end of a line, that's for a chat client probably, but who's to say that a chat client can't send multiple lines in a single outgoing packet? What if the data in OP's case is binary data? All he said was "data from user a to b", which doesn't exclude sending executables, pdf's or anything similar.
Correct me if I'm wrong, but doesn't P2P requires a bit of additional work for peer discovery? and probably some NAT punch through?
Have a cool signature? hit me up and I might use it.
DO NOT DEAL WITH THIS MEMBER
Aug 21, 2017 12:27 AM
(This post was last modified: Aug 21, 2017 12:38 AM by DeadKube.)
(Aug 20, 2017 09:45 PM)severos Wrote: Correct me if I'm wrong, but doesn't P2P requires a bit of additional work for peer discovery? and probably some NAT punch through?
Well that depends. You'd need some way to identify clients and let them know 'you're available' right? Hence the tracker lists that are usually in place for the torrenting network. But there's another way.
If you truly can't have any kind of a centralized resource, the best you can do is find the first peer through broadcasted messages and IP address scanning by definition. This approach, of course, is abusing the internet, as well as illegal in most countries. Imagine all the network traffic required to not only scan an IP for a single open port but basically all of them just to see if it's another client (worst case scenario for a SINGLE client). It would be easier if all your clients only used a specific port but you'd still need to scan a lot of them. Clients could then share these 'tracker lists' themselves by transferring their known list of other clients to a new one. Either way, it's more work than simply connecting to a traditional client server network. Sure, internally the same principles of send, receive and listen are used but the underlaying functionality is very different.
Aug 21, 2017 07:39 AM
(This post was last modified: Aug 21, 2017 07:43 AM by Trinity.)
(Aug 20, 2017 11:10 AM)DeadKube Wrote: Client to client connections are called p2p and would require a whole lot of work. I don't think OP is looking for that. Op please explain what you want in plain english. Do you want to make a custom client to make it look like you're someone else? If that's the case, any chat application with authentication capabilities will block you unless the server is vulnerable.
Java isn't really any different when it comes to sockets. You just send and receive and keep doing that until it's the end of the line. I coded a project like that once. I can send you the source in java code in exactly two weeks since I don't have access to my workspace. On holiday. Or wait just send me a pm with your email address and i might find it back. Keep in mind though that my particular java project was made in order to connect physical buttons to a server and once pressed they would notify an employee who has a smartdevice that is also connected to that server. It's not generic.
i never went to school, and i never ever had english lessons this is why my english isent that good but i can try and eksplain my self:
it's a web chat, what i want to be able to do is, send some commands(wich i allready know wich are) to the client/server and make it perform set action, i have seen this done.
A while back a fellow made a program for the chat, if you stand next to a guy or girl in the chat, you can whisper them, he found a way to whisper AS THEM from a distance, in the program. And that is the sort of things i wanna be able to do.
Regards EngLen🤝
Aug 21, 2017 09:02 AM
(This post was last modified: Aug 21, 2017 09:05 AM by 0xDEAD10CC.)
(Aug 20, 2017 09:45 PM)severos Wrote: Correct me if I'm wrong, but doesn't P2P requires a bit of additional work for peer discovery? and probably some NAT punch through?
What does discovery have to do with the concept of P2P? That's entirely optional if that's the functionality that you want to discover other clients, but it has nothing to do with the concept of P2P itself which is describing how the connection is made, not how clients are discovered... P2P just means "peer to peer". Btw, if you did add discovery, what difference would that be to discovering a server? There's lots of protocols you can use including SSDP, mDNS, or some other kind of multicast or broadcast message.
|