怎么没人讨论网设呢?

gugu 2001-10-15 12:10:24
讨论一下网设你们做得怎么样啦?
...全文
126 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
skt985 2002-01-11
  • 打赏
  • 举报
回复
42926关注! :)
ronaldlee 2001-10-16
  • 打赏
  • 举报
回复
我觉得下午的倒不难
只要有点C和Socket边城基础就搞定
Cisco那道题说白了
只是考拨号网络,一点也没有涉及到具体的参数设置
上午也是看了书就简单的那种
不好意思,我错了好多

March 2001-10-16
  • 打赏
  • 举报
回复
不好意思,是我写错了。
最近心情太不好,单不说那两个空填错了,就是前面记的东西也作地差,。
netying 2001-10-15
  • 打赏
  • 举报
回复
to march:你的这个说法我怎么都觉得不可能正确。if(argc=1)表示什么意思?
March 2001-10-15
  • 打赏
  • 举报
回复
to netying,多了参数肯定是不行的,而且也应写成if (argc=1)而不是==;我也昏了,居然把后面两个空的==全写成了=;I faint.
这次考试下午题出的太没水平,也许对网络一点不熟的人只要花时间去背,一样可以过。
而我,就惨了,前面的题几乎是乱凑上去的。
usxue 2001-10-15
  • 打赏
  • 举报
回复
你们认为下午的考题怎样??
反正我是没有想到是那种题,我死定了!
netying 2001-10-15
  • 打赏
  • 举报
回复
第一个空那我写的if(argc==1)行不?我觉得多几个参数对程序没影响,少了可不行
gugu 2001-10-15
  • 打赏
  • 举报
回复


新手上路 发表于 2001-10-15.13:05:57            
--------------------------------------------------------------------------------

简单的客户程序
  这个程序比服务器还简单。这个程序的所有工作是通过 3490 端口连接到命令行中指定的主机,然后得到服务器发送的字符串。
客户代码:
#include <stdio.h>
  #include <stdlib.h>
  #include <errno.h>
  #include <string.h>
  #include <sys/types.h>
  #include <netinet/in.h>
  #include <sys/socket.h>
  #include <sys/wait.h>
#define PORT 3490 /* 客户机连接远程主机的端口 */
#define MAXDATASIZE 100 /* 每次可以接收的最大字节 */
int main(int argc, char *argv[])
   {
   int sockfd, numbytes;
   char buf[MAXDATASIZE];
   struct hostent *he;
   struct sockaddr_in their_addr; /* connector's address information */
if (argc != 2) {
   fprintf(stderr,"usage: client hostname\n");
   exit(1);
   }
if ((he=gethostbyname(argv[1])) == NULL) { /* get the host info */
   herror("gethostbyname");
   exit(1);
   }

if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
   perror("socket");
   exit(1);
   }

their_addr.sin_family = AF_INET; /* host byte order */
  their_addr.sin_port = htons(PORT); /* short, network byte order */
  their_addr.sin_addr = *((struct in_addr *)he->h_addr);
  bzero(&(their_addr.sin_zero),; /* zero the rest of the struct */
if (connect(sockfd, (struct sockaddr *)&their_addr,sizeof(struct
sockaddr)) == -1) {
   perror("connect");
   exit(1);
   }
if ((numbytes=recv(sockfd, buf, MAXDATASIZE, 0)) == -1) {
   perror("recv");
   exit(1);
   }
buf[numbytes] = '\0';
printf("Received: %s",buf);
close(sockfd);
return 0;
   }


2,947

社区成员

发帖
与我相关
我的任务
社区描述
就计算机等级考试、软件初、中、高级不同级别资格考试相关话题交流经验,共享资源。
c1认证c4javac4前端 技术论坛(原bbs)
社区管理员
  • 软件水平考试社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧