#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <pthread.h>
#include <netdb.h>
int main(int argc,char **argv)
{
int ret;
int tcpsock;
char rbuf[10000]={0};
//获取阿里云api市场中,购买的那个物流查询服务器的信息
struct hostent *p=gethostbyname("wuliu.market.alicloudapi.com");
//ip地址不能直接打印,需要转换 char *inet_ntoa(struct in_addr in);
//*(p+1)等价于p[1]
struct in_addr * q=(struct in_addr *)(p->h_addr_list[0]);
printf("物流查询服务器的ip: %s\n",inet_ntoa(*q));
//定义ipv4地址结构体变量,存放需要绑定的ip和端口号
struct sockaddr_in bindaddr;
bzero(&bindaddr,sizeof(bindaddr));
bindaddr.sin_family=AF_INET;
bindaddr.sin_port=htons(20000); //小端序--》转换成大端序
bindad
阿里云平台使用apl
于 2023-03-13 19:20:18 首次发布
本文详细介绍了如何在阿里云平台上使用apl进行服务器管理和网络配置,包括登录、资源创建、网络设置等关键步骤,帮助用户高效操作云服务。
摘要由CSDN通过智能技术生成