如何将程序视为端口 [英] How do I blind my program to a port
本文介绍了如何将程序视为端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图消除我可以使用端口2020连接到我的计算机。我进行了登录,但我需要将其视为端口,所以当我登录时,它会让我访问我的计算机上的cmd,来自我的我办公室里的其他电脑。
i am trying to make away that i can connect to my computer using port 2020. i made the login but i need to blind it to the port so when i login it will give me access to cmd on my computer, from my other computer in my office.
#include "stdafx.h"
#include <string>
#include <iostream>
using namespace std;
int main()
{
system("COLOR 1E");
string userName;
string userPassword;
int loginAttempt = 0;
while (loginAttempt < 5)
{
system("CLS");
cout << "Please enter your user name: ";
cin >> userName;
cout << "Please enter your user password: ";
cin >> userPassword;
if (userName == "test" && userPassword == "test")
{
system("CLS");
cout << "Welcome Wolf!\n";
break;
system("PAUSE");
}
else
{
system("CLS");
cout << "Invalid login attempt. Please try again.\n" << '\n';
loginAttempt++;
system("PAUSE");
}
}
if (loginAttempt == 5)
{
system("CLS");
cout << "Too many login attempts!";
system("PAUSE");
}
system("PAUSE");
return 0;
}
我的尝试:
i尝试在网上寻找方式,我无法得到我追求的信息。 PS。我刚开始用C ++编程。所以我不擅长。
What I have tried:
i try finding a way online and i could not get the info i am after. ps. i have only started programing in C++. so i am not good at it.
推荐答案
用C ++编写用于初学者的Windows TCP套接字 [ ^ ]
C / C ++中的套接字编程 - GeeksforGeeks [ ^ ]
当然,两台计算机之间有一些网络连接......
Programming Windows TCP Sockets in C++ for the Beginner[^]
Socket Programming in C/C++ - GeeksforGeeks[^]
Of course you have some network connection between the two computers...
这篇关于如何将程序视为端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文