如果您对COMP2001JComputerNetwork感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于COMP2001JComputerNetwork的详细内容,并且为您提
如果您对COMP2001J Computer Network感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于COMP2001J Computer Network的详细内容,并且为您提供关于51nod 1470 计算机网络问题 Codeforces Round #310 (Div. 1)E. Case of Computer Network、A Self-Organized Computer Virus Demo in C、CE235 Computer Security、CF555E Case of Computer Network的有价值信息。
本文目录一览:- COMP2001J Computer Network
- 51nod 1470 计算机网络问题 Codeforces Round #310 (Div. 1)E. Case of Computer Network
- A Self-Organized Computer Virus Demo in C
- CE235 Computer Security
- CF555E Case of Computer Network
COMP2001J Computer Network
COMP2001J Computer Network 2024
1
Packet Tracer Lab: Introduction
Abstract:
You will learn the basics of setting up networks of computers in Packet Tracer by the following steps:
- Create a network by physically connecting two computers
- Get these two computers to communicate with each other
- Add more computers using a switch
- Add a router to allow communication outside of the network you have created
Note: All steps described in this lab note have been successfully tested using Packet Tracer 7.3 MacOS 64-
bit version.
Build a basic network
First, we create a basic network by adding two computers to the simulation and connecting them. When we
connect them together, we use a cross-over cable because we are connecting two devices of the same type.
This image with two green dots on both sides shows two computers have already been physically connected.
The dashed cable shows that it is a cross-over cable.
Basic network configuration
Before they can actually communicate, we must set up the network on each device.
By clicking on each individual component, we can configure the network settings of devices. In PC0, we set
its IP address 192.168.1.1 and its subnet mask 255.255.255.0.
In PC1, we set its IP address 192.168.2.1 and its subnet mask 255.255.255.0. Now send a message from PC0
to PC1 (click “add simple PDU”->click “pc0”->click “pc1”). Because the two computers are not in the same
subnet (why?), they cannot communicate with each other, and messages cannot be sent.
To solve this, we either change the subnet mask in both devices or change the IP address代 写 COMP2001J Computer Networkof one of the
computers to keep them in the same subnet. The easiest solution is to change the IP address of PC1 to
192.168.1.2.
COMP2001J Computer Network 2024
2
Adding more computers using a switch
A single cable is enough for two computers to communicate with each other. However, in reality, we usually
want more computers to be able to communicate and work together. To do this, we can add a switch. There
are many types of switches that can be added to the network simulations, we choose an empty switch
(Switch-PT-Empty) to get started.
Then, we need to add the necessary ports to this switch. In this example, we will connect four devices, so
we must add four ports to the switch (after we have powered it off). There are different types of ports:
ethernet (10 Mbps), fast ethernet (100 Mbps), and gigabit ethernet (1 Gbps). These are labeled ending in CE,
CFE, and CGE, respectively. As the computers we have created all have fast ethernet connections, we should
drag 4 of these to the switch and power it back on.
Now we can add some more devices (e.g., a laptop and a printer). These should all be connected to the
switch using a straight copper cable. Just like the previous example. we need to set the IP address of each
of the devices and their subnet masks. They should be set to the following values (192.168.1.1 reserved for
the gateway later):
• PC0: 192.168.1.2; 255.255.255.0
• PC1: 192.168.1.3; 255.255.255.0
• Laptop0: 192.168.1.4; 255.255.255.0
• Printer0: 192.168.1.5; 255.255.255.0
Now, you should send messages between any of the devices to test if they are connected.
Connecting to other networks using a router
We are going to add a router such that we can communicate with other devices outside our network. Routers
are more complicated to set up and configure than simple switches, so we must learn how to configure them.
First, we add an empty router to our simulation. We should add two fast ethernet ports to this empty router,
one for connecting to our switch and the other for connecting to something else in the other network. We
remove the “printer0” to free a port of the switch in our network. Connect the switch to the router using a
straight copper cable and click on the router to configure the device. Remember which port number in the
router that we connected the switch to.
Power it off COMP2001J Computer Network 2024
3
Router Configuration
To configure the router, we need to type commands into the CLI (Command Line Interface). This can be
opened by choosing the CLI tab and pressing enter. We should see a terminal like this:
This allows us to type the command into the system to change the settings. If we are unsure what the correct
command is, we can type “?” or add it to a command that we are not sure of.
- Before changing settings, we have to enable the privileged mode by typing the command enable (or
en). This gives us more options so that we can execute to change the settings.
- To start setting up the device, we use the configure terminal command. This allows us to configure
the different network interfaces.
- After this, we must select the correct interface and define the type of connection and the port
number. The switch is connected to this router using fastEthernet over port 0/0 so the command is:
interface fastEthernet 0/0
- Now we have selected the interface, we can set details like the IP address and subnet mask. This is
done with the command ip address followed by the ip address and the subnet mask. Here we are
going to give the address 192.168.1.1 to the network interface connected to the switch and give it
the same subnet mask as the other devices in the network.
Lastly, we need to activate the interface so that it is operational. This is done with the command no
shutdown. This means that the interface will remain on when the device is powered up.- Assuming that everything else is done correctly, you should see a message ending ‘changed state to
up’. Finally, we need to exit the interface (so we can configure another interface).
COMP2001J Computer Network 2024
4
Adding a server
Now, we will add a Server to our simulation and connect it to the second port on the router. These should
be connected using a cross-over cable. We will go through the same steps to set the IP address of this
network interface to 10.1.1.1 with a subnet of 255.255.255.0.
After this, we need to set the IP address of the server to 10.1.1.2 with a subnet of 255.255.255.0.
Additionally, we need to set the gateway to the IP address of the router in this network (10.1.1.1). Lastly,
we need to change the settings of all devices in the first network so that the default gateway is set to the
IP address of the router in the first network (192.168.1.1). Now, we should be able to send messages to
WX:codinghelp
51nod 1470 计算机网络问题 Codeforces Round #310 (Div. 1)E. Case of Computer Network
总结
以上是小编为你收集整理的51nod 1470 计算机网络问题 Codeforces Round #310 (Div. 1)E. Case of Computer Network全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
A Self-Organized Computer Virus Demo in C
A Program that can modify herself and copy herself to somewhere else and execute it. Just like gene-transformable virus.
Here''s the sample code.
#include "stdio.h"
#include "windows.h"
#define MAX_LOOP 10000
int main(int argc, const char** argv)
{
/*** THE VIRUS LOGIC PART ***/
//GENE_MARK
int a = 0;
printf("GENE PRINT:%d\n", a);
/*** THE VIRUS LOGIC PART ***/
// FILE NAME
char file_name[30] = "test";
// MAKE A COPY OF HERSELF
FILE* source = fopen("test.c", "r");
FILE* descendant = fopen("descendant.c", "w+");
printf("SOURCE FILE OPEN RESULT IS : %d \n", (int)source);
printf("DESCENDANT FILE CREATED: %d \n", (int)descendant);
if(descendant==NULL)
{
printf("ERROR ON CREATING DESCENDANT.\n");
return -1;
}
char buff[100] = {0};
// REPLACE GENE MARK PROGRAM
char letter = 0;
// GENE LINE
int idx = 0;
int loop = 0;
int buff_idx = 0;
while(!feof(source))
{
// ALARM
if(loop>MAX_LOOP)
break;
loop ++;
fread(&letter, sizeof(char), 1, source);
buff[buff_idx] = letter;
buff_idx ++;
if(letter==''\n'')
{
if(idx==9)
{
// TRANSFORM GENE
memset(buff, 0, 100);
buff_idx = 0;
strcat(buff, "int a = 1;\n");
}
fwrite(buff, sizeof(char), strlen(buff), descendant);
// CLEAR BUFFER
memset(buff, 0, 100);
buff_idx = 0;
idx ++;
}
}
// DEAL WITH LEFT LETTERS IN BUFFER
if(strlen(buff)>0)
{
strcat(buff, "\n");
fwrite(buff, sizeof(char), strlen(buff)+1, descendant);
}
// CLOSE ALL FILES
fclose(source);
fclose(descendant);
// until the descendant file is written over
/*** COMPILE HERSELF ***/
char* source_file = "descendant.c";
char* dest_file = "descendant.exe";
char command[100] = {0};
strcat(command, "gcc -o ");
strcat(command, dest_file);
strcat(command, " ");
strcat(command, source_file);
// COMPILATION
system(command);
/***********************/
printf("COPYING MYSELF DONE.\n");
printf("WAITING FOR NEXT INSTRUCTION...\n");
char cmd = getchar();
if(cmd==''Y'')
{
printf("BEGIN EXECUTE THE COPYFILE EXECUTION...\n");
//GENE_MARK
system("descendant.exe");
printf("EXECUTION PROCESS IS ACTIVATED, TASK DONE. EXIT SYSTEM.");
}
else
printf("YOU CHOOSE TO EXIT SYSTEM. BYE!");
return 0;
}
If you have any suggestions or ideas, please feel free comment below, thanks!
CE235 Computer Security
CE235 Computer Security Assignment 3
The assignment is worth 7.5% of the total mark for this module. This assignment involves writing a C/C++ program for task 1 described below. The purpose of this assignment is for you to get a good understanding of the SHA-256.
The task:
Task 1 (7.5%)
Read the description and the pseudocode of SHA-256 at https://en.wikipedia.org/wiki/SHA-2 and develop the program called ConsoleSHA.cpp (which will be later renamed to CE235A3.cpp). Your program needs to be able to take an input and show the resulting hash value.
The program should contain brief comments describing the main block of the program, and the program should be laid out neatly with consistent indentation.
Assessment criteria:
Correctness of program 50%
Quality of program 25%
Clarity of program and comments 25%
Submission
You are required to submit the source code files (CE235A3.cpp). All of the files should be placed in a single folder which should then be zipped for submission to the coursework submission system (FASER), i.e. the submission should be a single file in zip format.
After you complete your programs, you should demonstrate them to the module supervisor.
Late submission and plagiarism
This assignment is to be done individually, i.e. whatever you submit must be your own individual work. Any software or any other materials that you use in this assignment, whether previously published or not, must be referred to and properly acknowledged. Please be aware that the module supervisor may ask students for an interview to explain their submitted work.
Please refer to the Undergraduate Students’ Handbook for details of the School policy regarding late submission and University regulations regarding plagiarism:
http://www.essex.ac.uk/ldev/resources/plagiarism/default.aspx
http://www.essex.ac.uk/about/governance/policies/academic-offences.aspx
因为专业,所以值得信赖。如有需要,请加 QQ:99515681 或 微信:codehelp
CF555E Case of Computer Network
传送门
题意
题解
容易发现,在同一个边双内的点我们是不用管它的,一定可以。
那么我们缩点,然后把图变成一颗树。这样,$s$ 到 $t$ 的路径就可以用$\mathrm{LCA}$求了。
我们把 $s$ 到 $\mathrm{LCA}$ 的路径打向上的标记,把 $\mathrm{LCA}$ 到 $t$ 的路径打向下的标记。
只要没有路径有两种标记,就是可以的。
打标记使用树上差分实现。时间复杂度:$\mathcal O\left(n+m+q\mathrm{lg}n\right)$。
附上代码:
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define down(x, y) x = min(x, y)
int n, m, q;
struct edge {
int from, to, nxt, id;
} edges[400005];
struct edgE {
int to, nxt;
} edgEs[400005];
int e0, e = 1, e2 = 1, hed[200005], hEd[200005], tim = 0, fa[200005], dfn[200005], low[200005], scc[200005], dis[200005], lca[18][200005];
int flg[200005]; bool root[200005]; bool goon[200005];
int leaves[200005], top=0;
const int CLEAN_FLAG = 0x1;
const int UP_FLAG = 0x2;
const int DOWN_FLAG = 0x4;
stack<int> S;
inline bool hasflag(int x, int attr) {
return flg[x] & attr;
}
inline bool setflag(int x, int attr) {
if (attr == UP_FLAG && hasflag(x, DOWN_FLAG)) return false;
if (attr == DOWN_FLAG && hasflag(x, UP_FLAG)) return false;
flg[x] |= attr;
return true;
}
inline void addedge(int x, int y) {
edges[e] = (edge){x, y, hed[x], e2};
hed[x] = e++;
edges[e] = (edge){y, x, hed[y], e2++};
hed[y] = e++;
}
inline void addedgE(int x, int y) {
edgEs[e] = (edgE){y, hEd[x]};
hEd[x] = e++;
}
inline void _tarjan(int x) {
dfn[x] = low[x] = ++tim;
S.push(x);
for (int e=hed[x]; e; e=edges[e].nxt) {
int y = edges[e].to;
if (edges[e].id == fa[x]) continue;
if (!dfn[y]) {
fa[y] = edges[e].id;
_tarjan(y);
down(low[x], low[y]);
} else down(low[x], dfn[y]);
}
if (dfn[x] == low[x]) {
scc[x] = ++e2;
while (S.top() != x) {
scc[S.top()] = e2;
S.pop();
}
S.pop();
}
}
inline void tarjan() {
for (int i=1; i<=n; i++) if (!dfn[i]) _tarjan(i);
for (int i = 0; i < e0; i++) {
int x = edges[i].from, y = edges[i].to;
if (scc[x] == scc[y]) continue;
addedgE(scc[x], scc[y]);
}
}
inline void lca_pre() {
for (int i=1; i<18; i++)
for (int j=1; j<=n; j++)
lca[i][j] = lca[i-1][lca[i-1][j]];
}
inline int LCA(int x, int y) {
if (dis[x] > dis[y]) swap(x, y);
int u = dis[x], v = dis[y];
int X=x, Y=y;
for (int det = v-u, i=0; det; det>>=1, ++i)
if (det & 1) Y = lca[i][Y];
if (X == Y) return X;
for (int i=17; i>=0; i--) {
if (lca[i][X] == lca[i][Y]) continue;
X = lca[i][X]; Y = lca[i][Y];
}
return lca[0][X];
}
int group[200005], current;
inline void dfs(int x, int fa) {
bool isleaf = true; group[x] = current;
for (int e=hEd[x]; e; e=edgEs[e].nxt) {
int y = edgEs[e].to;
if (y != fa) {
isleaf = false;
lca[0][y] = x;
dis[y] = dis[x] + 1;
dfs(y, x);
}
}
if (isleaf) leaves[top++] = x;
}
inline bool akmachine(int x, int flag) {
while (!root[x]) {
if (goon[x]) return true;
goon[x] = true;
if (hasflag(x, UP_FLAG) && !hasflag(x, CLEAN_FLAG) && (flag & DOWN_FLAG)
|| hasflag(x, DOWN_FLAG) && !hasflag(x, CLEAN_FLAG) && (flag & UP_FLAG))
return false;
if (hasflag(x, CLEAN_FLAG)) flag = 0;
flag = flg[x] & (UP_FLAG | DOWN_FLAG);
x = lca[0][x];
}
return true;
}
inline bool check() {
for (int i=0; i<top; i++) if (!akmachine(leaves[i], 0)) return false;
return true;
}
inline bool solve() {
for (int i=1; i<=n; i++)
if (!dis[i]) {
current = i; lca[0][i] = i; root[i] = 1;
dfs(i, 0);
}
lca_pre();
while (q--) {
int s, t; cin >> s >> t;
s = scc[s]; t = scc[t];
if (group[s] != group[t]) return false;
if (s == t) continue;
int p = LCA(s, t);
if (p != s) if (!setflag(s, UP_FLAG)) return false;
if (p != t) if (!setflag(t, DOWN_FLAG)) return false;
setflag(p, CLEAN_FLAG);
}
return check();
}
int main() {
ios :: sync_with_stdio(false); cin.tie(0);
cin >> n >> m >> q;
for (int i=1; i<=m; i++) {
int x, y; cin >> x >> y;
addedge(x, y);
}
e0 = e; e = 1; e2 = 0; tarjan();
cout << (solve() ? "Yes" : "No") << endl;
return 0;
}
今天的关于COMP2001J Computer Network的分享已经结束,谢谢您的关注,如果想了解更多关于51nod 1470 计算机网络问题 Codeforces Round #310 (Div. 1)E. Case of Computer Network、A Self-Organized Computer Virus Demo in C、CE235 Computer Security、CF555E Case of Computer Network的相关知识,请在本站进行查询。
本文标签: