Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <pthread.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <netdb.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <unistd.h>
- #include <stdio.h>
- #include <arpa/inet.h>
- int main() {
- int connection_socket_descriptor;
- int b;
- char buf;
- char alf[26]="qwertyuioplkjhgfdsazxcvbnm";
- struct sockaddr_in server_address;
- //connection_socket_descriptor = socket(AF_INET, SOCK_STREAM, 0);
- memset(&server_address, 0, sizeof(server_address));
- server_address.sin_family = AF_INET;
- inet_pton(AF_INET, "150.254.32.68", &(server_address.sin_addr));
- server_address.sin_port = htons(1235);
- /* ZAD1
- connect(connection_socket_descriptor, (struct sockaddr*)&server_address, sizeof(server_address));
- while(1)
- for(int i=0; i<100; i++)
- {
- //sleep(1);
- b = write(connection_socket_descriptor, buf, 100);
- //read(connection_socket_descriptor, buf, 100);
- printf("%d, taki duży bufor: %d\n", i, b);
- }
- close(connection_socket_descriptor);*/
- while(1)
- for(int i=0; i<26; i++)
- {
- sleep(1);
- connection_socket_descriptor = socket(AF_INET, SOCK_STREAM, 0);
- connect(connection_socket_descriptor, (struct sockaddr*)&server_address, sizeof(server_address));
- buf = alf[i];
- b = write(connection_socket_descriptor, &buf, 1);
- //read(connection_socket_descriptor, buf, 100);
- printf("Wysłane: %d\n", b);
- close(connection_socket_descriptor);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement