C语言怎么给手机发短信

本文详细介绍了如何在Linux环境下利用C语言编程实现向手机发送短信的功能,涉及到了通信协议、库函数的使用以及相关开发技巧。
摘要由CSDN通过智能技术生成
学习编程的第N天,发现一个超简单验证码短信接口对接DEMO示例

#include <stdio.h>

#include <sys/socket.h>

#include <sys/types.h>

#include <time.h>

#include <errno.h>

#include <signal.h>

#include <stdlib.h>

#include <string.h>

#include <unistd.h>

#include <sys/wait.h>

#include <sys/time.h>

#include <netinet/in.h>

#include <arpa/inet.h>

#define IPSTR "106.ihuyi.com"

#define PORT 80

#define BUFSIZE 1024

//调试日期 2015-07-27

//linux下的编译方法 gcc -o sms sms.c

int main(int argc, char **argv)

{

        int sockfd, ret, i, h,srandnum;

        struct sockaddr_in servaddr;

        char str1[4096], str2[4096], buf[BUFSIZE], *str;

        socklen_t len;

        fd_set  t_set1;

        struct timeval  tv;

        if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0 ) {

                printf("创建网络连接失败,本线程即将终止---socket error!\n");

                exit(0);

        };

    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值