C# :: Created A Simple Basic Program That Uses Sockets
Feb 22, 2012
I have created a simple basic program that uses sockets but it can only handle one connection, how do I make it so it handles multiple connections?
Server code:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
}
[code]...
View 5 Replies
ADVERTISEMENT
Sep 29, 2013
I am having trouble with an assignment. The assignment consists of a basic encryption and decryption program already written for me, I just have to write the encryption function. What we have to get the program to do is enter an integer and a text, and get the program to increment each letter in the text by the integer given. I did this by using a for loop and incrementing each value in the string by the integer.
However, I still can't get it to decrypt and I need the program to work with only a-z letters (if I increment each letter by 3 and I have the letter Z, it should go to Z+3 = C).
I attached the description of the attachment and below are the codes: The first file does not need to be edited.
Code:
/*******************Programming Assignment 1***************/
/****************Caesar's substitution cipher**************/
/*****************YOU MUST NOT EDIT THIS FILE**************/
/****Substitute alphabets in a string using rotation key***/
/****Leave all other characters unchanged******************/
/****Confirm correct encryption by decrypting**************/
[Code] ......
View 1 Replies
View Related
Feb 4, 2014
Code:
#include <stdio.h>
void Swap(int *x, int *y);
int *Largest(int *array, int size);
int main()
{
int a, b, i;
int c[10];
int maxaddress;
}
[code]...
My swap function works fine, but I am trying to find the ADDRESS of the largest element in my array and I am getting an error using gcc on my "return &largest;" and my printf line in my main function.How can I fix this and return the address of the largest?
View 8 Replies
View Related
May 18, 2014
This is my program
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
#include<math.h>
struct date
{int dd,mm,yy;}
[Code] ....
Error in Line 11:Too many types in declaration
View 2 Replies
View Related
Feb 29, 2012
im trying to write a program that prompts the user to enter three numbers and then prints them vertically (each on one line), first forward and then reversed. this is how the design should look:
enter three numbers: 1 43 54
your numbers fowards:
1
43
54
your numbers backwards:
54
43
1
this is what i have thus far when it comes to code....
#include <stdio>
int main (void) {
// local declarations
int a;
int b;
int c
[code].....
View 1 Replies
View Related
Nov 12, 2014
I'm basically trying to create a program that will project a soccer teams points for the whole season. Here are the basics:
Total games: 38
Win: 3 pts
Draw: 1 pt
Loss: 0 pts
My program compiles fine, but inevitably crashes right before the if statement..
Code:
#include<stdio.h>
int main(void)
{
float ppg, games_played, games_left, points_earned, pts_proj;
char team_one;
}
[code]....
View 4 Replies
View Related
Aug 6, 2014
I am trying to send yahoo mail using socket program.
Using the commands like ehlo, starttls, auth login, data,.,quit.
but starttls is error. yahoo close itself. one more thing i use this same method for gmail is working.
The problem is we must enable the ssl authentication. Like System.net mail in .net package smtp.enablessl=true. how i enable ssl authentication in starttls in c++ program
View 1 Replies
View Related
May 16, 2014
I tried to build a basic username-password verification program; I already have 2 text documents, usr.txt and pass.txt in which username and password are stored. Then have written this program to check the username and password, but every time it says Access Denied.
Here's what I have written:
#include<stdio.h>
#include<conio.h>
void main()
[Code].....
View 6 Replies
View Related
Oct 19, 2014
I am making a very basic parent/child class based program that shows polymorphism. It does not compile due to a few syntax errors reading "function call missing argument list. Lines 76 and 77, 81 and 82, and 86 and 87.
#include<iostream>
using namespace std;
class people {
public:
virtual void height(double h) = 0;
virtual void weight(double w) = 0;
[Code] ....
View 4 Replies
View Related
Jul 13, 2013
Until recently I have been using select() to wait for activity on file descriptors, however this seems less efficient than poll. I rewrote the program using poll:
Server:
Code:
#include <stdio.h>#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <limits.h>
#include <sys/types.h>
}
[code].....
View 11 Replies
View Related
Oct 30, 2013
I have a socket connection already set up, my thing is what would be the best way to send a packet through sockets? My teacher wants us to convert the packet to bits first before we send it. I think he wants something like this:
Code:
struct packet{
int header
int message
int flag
}clientpacket; m
My question is how do we covert this to bits, before sending it. One of my friends said we can create a char[] array the size of the struct as a buffer. will memcpy() change the struct to bits if I copy it to the buffer?
this is how is suppose to look in bits for the header field/column.
Field : header
Field size(bits): 8
data format: Unsigned int
value example: 1
Value in bits: 0000 0001
I am confused, I think I send a structure over the socket but I did not convert it to bits before I sent it .
View 13 Replies
View Related
Apr 9, 2013
I'm connecting to my website through sockets, like this:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <winsock2.h>
#include <string.h>
int main(int argc, char *argv[]) {
WSADATA wsadata;
if (WSAStartup(MAKEWORD(2,2), &wsadata) == -1)
[Code]...
I want to send GET to a certain web page. How can I do that?
View 2 Replies
View Related
Nov 1, 2013
I want to write a program(s) so that the client sits and waits for a scanf to receive an int, then send to server, server then receives the int, processes it, then goes back to sit and wait for new input. to start with, where do i start! server side, or client side? and also what order do i have to go in my program before the loop to set up the socket, and listen? and then what gets looped to keep the connection open and wait for new receive?
View 4 Replies
View Related
Jan 26, 2013
I have struggled to send email from my MFC applications using severl methods:
1) http via my server - works but limited
2) M$ Outlook automation - works but not easily interchangeable between machines
3) Windows Sockets - available information simply too complicated
4) Purchase an ActiveX control - I hate black box solutions and am too cheap
I have looked at P. J. Naughter's class
CPJNSMTPConnection v2.99
An MFC class to encapsulate the SMTP protocol
[URL]
This approach requires the implementation of OpenSSL which turns out to be nothing short of a nightmare to install (so I never got it to run). I am looking for an example of an application that utilizes SMTP via Windows sockets api.
View 6 Replies
View Related
Oct 7, 2012
Have tried to track down the delay? Which function takes that long? Have you printed some logs or measured the time of the functions? No I am not sure how to do that! I debugged it but i didn't see any difference! I definitely think its the logic in the receive code that's "inefficient" what do you think about that? Do you think there's a more efficient way of receiving messages and sending them? Because what I am doing is receiving one then calling send and sending that message out to all users then receiving another one then calling send and sending it out to all users and repeating that process till all the messages are sent, both methods are using a loop to send to all users. DO you think i should receive all messages then send them all out at once? or is that less efficient?
View 4 Replies
View Related
Feb 12, 2014
I would like to know how can I make a simple program .exe so that I don't have to open it through code blocks every time.
View 2 Replies
View Related
Feb 27, 2014
3. Write a program that reads a sequence of positive integers and prints out their sum, except that if the same number occurs several times consecutively, ignore all but the first. Assume an input of 0 marks the end of the input. For example, if the input is 3 8 5 5 4 9 1 1 1 1 8 0 then you should print 38 (i.e., ignore one of the 5's and three of the 1's).
View 5 Replies
View Related
Sep 28, 2013
I would to learn how could i calculate the offset of simple c program?
Lets say that I have that simple program:
Code:
#include <stdio.h>
int main() {
int x=1;
printf("x = %d", x);
return 0;
}
View 9 Replies
View Related
Aug 1, 2013
my program is printing out a random symbol afterwards , when trying to copy a sequence of chars into a new buffer.
Code:
#include <stdio.h>#include <stdlib.h>
int tokenCopy(char* dest, const char* src, int destSize);
int main() {
char buff[3];
int n = tokenCopy(buff, "This is a string", 3);
printf("%d '%s'
", n, buff);
[code]....
View 2 Replies
View Related
Dec 14, 2013
Code:
#include <stdio.h>
int main(){
double nc;
for (nc = 0; getchar() != EOF; ++nc)
;
printf("%.0f
", nc);
}
It works well and I am using ctrl-D as my EOF. Now I understand that C is not really a language for dealing with text, which is why I am learning it more in depth, my degree was in robotics, and I think C is definitely the best place to be for me. So this may just be a quirk, but if I type more than 10 characters, I get the right answer from the program, however, if I type less than 10, for the sake of argument I type Hello and then return, if I at that point do ctrl-D, I get the answer 6D?
The 6 is right 5 letters and a return character, but what is the D?
View 2 Replies
View Related
May 1, 2013
I'm trying to write a program that detects deadlock. Some of the code I already tested in an earlier stage but at this point when I run the code it somehow gets stuck. I believe that it has something to do with a negative integer value. Anyhow, the program should still work if a negative integer comes up. Here's my code so far.
Code:
#include <stdio.h>
#define FALSE 0
#define TRUE 1
int ALLOC[5][5], REQ[5][5], TOT_RES[5], process, resource, NUMB_RES=5, NUMB_PRO=5;
int TMP[5]={0}, AVAIL[5], CNTR=0, FIN[5]={FALSE}, FLAG;
}
[code]....
The program usually gets stuck after producing output displaying the "Available: " text. After that a list of tabbed numbers should appear, but it doesn't.
View 4 Replies
View Related
Mar 23, 2014
I decided to create a simple program to display a menu with options, while that is easy enough I had some difficulty when selecting an option that has options inside which also has an option again. While I had many issues in the past I'm finally finished with it and it works fine, but being new to programming and not knowing various other methods available.
Code:
//:::::::::::::::::::::Simple Menu Program::::::::::::::::
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#include <iostream>
#include <string>
//function prototypes
[Code] .....
View 1 Replies
View Related
May 1, 2014
I have been working on a simple crc32 program in octave and have been using a program already done in C as a guideline. I have been having some problems since octave and C simply do things differently. Right now i have a problem with right shifting.
unsigned int crc = -85
unsigned int x = (crc >> 1);
The resulting x will be 2147483605. I tried putting 0xFFFFFFFF instead of -85 and i got the same result.
If i put -85 for crc in octave, i get a small number -43 which looks more reasonable.
View 1 Replies
View Related
Mar 6, 2015
The assignment is to write a program that statistically computes similarity of C syntax with another program; a same and a different. The one used here is in C language, it's called Battleship.cpp. The program must open a file and read line by line for keywords and then produce statistics. The reason my code is not running is the fopen function is failing and it goes to return -1. I am using MS Visual Studio 2013 and there are no compiler errors after turning off deprecation. I do see, however, this error UMEngx86.dll'. Cannot find or open the PDB file. The file being opened is in my source folder.
Code:
1
2
3
4
5
[code]....
View 4 Replies
View Related
Mar 25, 2014
My program allows a server and a client to chat over a socket. Currently I have to wait for one of them to type a message and press enter, before a message from the other person can be received.
Is there a simple way for messages to be received instantly - but not disturb any message that is being typed in?
View 2 Replies
View Related
Jul 22, 2014
I am trying to make a simple program for encrypting a char* with the XOR operator. The code compiles and links perfectly, but I get an Access violation runtime error:
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <fstream>
using namespace std;
int main(int argc, char** argv) {
[Code] .....
Text that I am inputting:
My username is memberfunction.
View 9 Replies
View Related