How get the server ip in socket progrmming? - qt

I want to create a chat application like telegram in qt quick.
I had tested the application with IP 127.0.0.1 and I send a message to the server and the server will receive the message.
Now if I deploy the application, there will be many clients and any client is the server for another client(If I understood correctly the socket programming).
So when a user wants to send a message to another user, He should have the IP of another user(that is server), So How can I solve the problem of having IP of another user?
I have a rest API(asp.net core) for signup users. Should I save the last IP of each user when he make a request in my asp.net core web api? and with get list of contact I send the last IP too?
Or there is a another way in socket progrmming?

Related

How to use a client websocket to connect to a remote websocket windows server

Help needed please
What's is the best WebSocket client library for a .net 4.5 on windows web application hosted on windows 2008 servers to connect to a remote server web socket.
The scenario is: our web application will use a web socket to connect to a server WebSocket on a third party infrastructure. Our client WebSocket will connect and send some commands and read the responses where we can identify the information needed. So there is no interaction from the user or browser its just in the code. e.g. user clicks a button and we go and get some data, and give a message dependant on the response.
so for example our client will connect to the third party socket and pass the users car registration number and send a tell me the car details and the server socket will return the data like: make, model, year etc... so we can then display that to the user.
Has anyone used this library with some good success? http://www.nuget.org/packages/WebSocket4Net
I'm hoping someone here can provide the best approach for doing this with some tried and tested solutions. I have been thinking about a web API that handles all the socket stuff in our client so i can call it and let it handle the close connection etc.

Server to server messaging using signalr

Can anyone tell me how can we send server to server message with signalR?
I am creating chat application for that I used sub domain concept as there was problem in opening multiple concurrent connections with signalr. But using subdomain concept, chat is not implemented properly as it does not send message to connection opened from other subdomain. Can any one suggest me solution that how can we send messages to and from server in signalR?
I have already tried to implement centalized approach to store and use the connectionID but not worked.

asp.net smtp mail queue

does anyone know of a module thats available for asp.net that uses a queue to send email to an smtp server?
the queue being the operative word here.. we need a proper fallback mechanism for storing any messages that can't be sent so that the send can be re-attempted later
thanks
You can submit your messages to an IIS SMTP relay server via the Pickup Folder. This is the cheapest, and probably best, outgoing mail queue for ASP.NET.
Otherwise, you'll just need to connect to your SMTP relay server and configure its queue in whatever manner meets your business needs.

Chat Application in ASP.NET

I've to write an Ajax chat web application in ASP.NET for a friend, and I've a question: if client1 sends a message to client2, how should the application send the message to client2? Is there a better way than sending requests to the server, "asking" if there are new messages? Is it possible to directly send the message to the client?
Best thing you can do is use a Persistent HTTP Connection. The way google does with Google Talk on their GMAIL website.
Remember that HTTP is a stateless protocol and that each transaction is made from the client to the server.
The server can use sessions to determine if this client is "known" but as for sending information back to the client using plain old HTTP I think that is impossible (I mean from a server initiated connection, not a response to the client)
You would need to use Javascript to poll the server for information.
If you want it the other way around, you could possibly use Java or Flash but then you also need to think about NAT tunneling, proxy servers and any other weird setups that the clients could be using.
No. I don't think the server can send message to client's browser.
Here is how I implement chat application:
client1 post message via Ajax to server
server save it to repository (I'm using singleton object for this case)
client2 get the message from repository
mark the message as read
I will save chat logs to database once the chat session closed or expired.

Getting An IP Address in a CSLA remote data portal

I'm writing an app in CSLA and want to log IP addresses, but only if the client is calling a remote data portal (such as the WCF one).
How can I get the client's IP address when executing within a remote data portal? I realize I could probably pass it with the request, but I'd like to avoid this if possible.
CSLA .NET forum thread on this topic

Resources