c ++通过互联网在两个用户之间共享数据? [英] c++ share data between two users through internet?

查看:83
本文介绍了c ++通过互联网在两个用户之间共享数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过互联网在两个用户之间共享数据。我是怎么做到的?

解决方案

您基本上有两种选择适合互联网模式。



1.客户端服务器。您找到一个运行或将运行服务器软件的互联网服务提供商,例如Apache Web服务器,它将允许通过互联网与其建立连接以及要发送和接收的数据。然后,2个或更多客户端可以连接到此服务器并与其交换数据,并最终相互交换。现在你有了Facebook!



2. Peer to Peer。您可以在一个软件中创建客户端部件和小型服务器部件。每个用户运行该软件,并且所有正在运行的实例形成发送者/接收者的对等网络。现在你有了BitTorrent!



实际的发送和接收部分是通过一组称为OSI堆栈的技术完成的。你已经知道其中一个,IP(因特网协议)因为没有IP地址你不能在线向问题项目发布问题。

在协议栈的顶部,所谓的应用程序层中的IP和TCP(传输控制协议)就像套接字这样的技术。



你可以使用Socket编程通过互联网发送和接收数据以某种方式使其与读取和写入文件非常相似,除了文件实际上是与用于设置套接字的IP地址的另一台计算机的连接。



网上有大量书籍和更多关于此的内容,而不是100年后的内容。 Google为您提供了一个简单的聊天程序,可以选择您的编程技术入门。套接字是一种很好的技术,特别是如果你想通过编写代码获得报酬。 : - )

I want to share data between two users through internet. How ca i do that?

解决方案

You have essentially 2 choices that fit with the internet model.

1. Client Server. You find an internet service provider that runs or will run a piece of server software, like the Apache Web Server for example, which will allow connections to be made to it over the internet and data to be sent and recieved. 2 or more Clients can then connect to this server and exchange data with it and ultimately with one another. Now you have Facebook!

2. Peer to Peer. You make the Client Part and a small Server Part in one piece of software. Each user runs the software and a peer-to-peer network of sender/recievers is formed by all the running instances. Now you have BitTorrent!

The actual sending and recieving part is done with a set of technologies called the OSI stack. You''ll already know about one of them, IP (Internet Protocol) because without an IP address you couldn''t be online posting questions to Code Project.
At the top of the protocol stack, above IP and TCP (Transmision Control Protocol) in what is called the application layer are technologies like Sockets.

You can use Socket programming to send and recieve data over the internet in a way that makes it very very similar to reading and writing a file, except the ''file'' is really a connection to another computer at the IP address you use to set up the socket.

There are loads of books and more stuff online about this than you could read in a 100 years. Google for a simple Chat program in your programming technology of choice to get started. Sockets are a great technology to master especially if you want to get paid for writing code. :-)


这篇关于c ++通过互联网在两个用户之间共享数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆