Visual C++ :: How To Detect Multicast Group Address

Nov 13, 2013

I have a problem with UDP Multicast. I managed to send UDP Multicast telegrams and receive them. But when I receive the telegram I need to find out to which multicast group address it was sent. So far I have:

Code:
recvfrom( hSocket,
pcData,
nMaxDataLen,
0,
(SOCKADDR*) &from,
&len);

When I read from.sin_addr.S_un.S_addr; then I get the original IP Adresse from the sender PC but I also would like to know to which group address it was sent. Is there a way to get this infoamtion?

View 3 Replies


ADVERTISEMENT

Visual C++ :: Using The Same Port For 2 UDP Multicast Groups?

Jun 20, 2014

I habe a program, that can send and receive UDP Multicast telegrams. When I open the socket then I bind my multicast group address and the local port to a specified networkcard (our PC has 2 network cards). Now I have a special constellation:

Our PC has 2 network cards. Multicast group 1 shall use card 1 and group shall use card 2. As long as both groups use different local ports it works fine. But when both group want to use the same port number then I can receive and send telegrams only through the first group that was created. For the second one I don't even get a FD_READ event at all.

Code:
SrvAddr.sin_family = AF_INET;
SrvAddr.sin_port = htons( (WORD) nLocalPort );
SrvAddr.sin_addr.s_addr = inet_addr(strOwnIpAddress); // bind multicast group socket to a specified networkcard
// If bind socket to port failed
if( bind( hSocket,

[Code] .....

View 2 Replies View Related

Visual C++ :: Sum Multiple Group To Find The Max

Dec 17, 2013

How to sum groups in C++? I have a class with 2 attributes (Group and Price). I need to find the group with the highest amount. I can find the max when it comes to finding a set of individual numbers but not when a group is required. For Ex:

Group A64
Group A48
Group A18
Group B49
Group B36
Group C64
Group C75
Group C87
Group C72

The group with the highest amount is GROUP C

View 14 Replies View Related

Visual C++ :: Program To Output A Line For A Specific Age Group - CPP File

Feb 13, 2013

I am suppose to make a program that will output a line for a specific age group,but everytime I execute the exe file it gives me the desired line and also the last line included everytime.Where did I go wrong with it including the last line everytime?

#include <iostream>
using namespace std;
int main() {
double age;
cout<<"Enter your age:";
cin>>age;
if (0<age && age <6)

[Code] ......

View 1 Replies View Related

Visual C++ :: Edit / Update And Display Group Of 40 Parameters On Screen

Feb 26, 2014

I need to edit ,update and display a group of 40 parameters on screen. (10 parameters per page and use of Arrow Key pad or touch screen clicks to modify value)....

For that I will need .. Parameter No . , String Name , Point Screen Cord , double value , next element no. etc I have my old code with structure and array of structure written in C. I have translated it on C++/MFC .

How can I implement Class property of c++ ?

View 8 Replies View Related

Visual C++ :: Detect ItemID And Delete That Line From File

Oct 14, 2013

I have a text file name fruit.txt that contains the following information of fruit id, fruitName and fruitQuantity.

Code:
1:pear:30
2:apple:20
3:banana:24
4:orange:15
5:watermelon:35

If let's say I key in 2, it will search for the id=2 and delete the whole line and the id of banana which is orignially 3, will become 2 and orange which is orignally 4 will become 3 etc.

I researched on how it can be done and most suggested to put inside a vector and fout the line.

I know how to put the values in the vector but how should I go about searching for the id and if the id is found it will delete that line inside the file.

Code:
ofstream fout;
ifstream readFile("fruit.txt");
while (getline(readFile, line)) {

[Code]....

View 2 Replies View Related

C++ :: Building Multicast Packet - Memcpy Casting

Aug 19, 2014

I am just getting back in to C++ after 10 years not doing any, contributing to an open source project. I'm adding in some functionality and am hitting a road block.

I need to send a multicast packet out on the network that is structured in a certain way. I have the definition, and know what data is going in each byte. I can successfully send a message using multicast, I now just need to send the right message.

I have used a char array to hold the message, as each char represents 1 byte, and I can transmit the array.

I am having trouble putting all of the data in the right place though. If my source data is a string, then I seem to be able to convert it, but if it is a short or int, then I keep getting errors when compiling. Similarly, two of the lines, (version and type) i initially tried using char arrays with a length of one.

Should I be using memcpy or a different function, or even be doing this in a totally different way altogether? This is the code that I am using, along with the packet structure:

//Construct a Zone Query packet
// 4 bytes - Signature "Ohz " = 0x6f, 0x68, 0x7a, 0x20
// 1 bytes - Version = 1
// 1 bytes - Type (0 = Zone Query, 1 = Zone Uri)
// 2 bytes - Entire message length = 12 + zone length
// 4 bytes - Length in bytes of the zone ID
// n bytes - Zone ID to query

[Code] ....

The errors that I get are:

error: invalid conversion from ‘short int’ to ‘const void*’ [-fpermissive]
memcpy(buffer + 6, packetLength, sizeof(packetLength));
^
[Code] ....

View 9 Replies View Related

Visual C++ :: How To Detect If Window Media Player Is Running In Full Screen Mode

Jan 21, 2013

How can I check if window media player is running in full screen mode & topmost in c++ MFC?

What I used is this logic:

I compared media player full screen coordinates to that of monitor coordinates.If they are same implies media player is in fullscreen.But it has one flaw.Whenever there are control(for play,pause) displayed in full screen in media player, coordinates are not coming same as that of monitor.

View 10 Replies View Related

Visual C++ :: Detect And Find Rotation Angle If Skeleton Tracked Turned 180 Degree To Kinect

Sep 25, 2013

I m developing an application using kinect.The IDE I use is Visual studio 2012 and kinect SDK 1.8.I m developing using vc++

I want to overlay an image on the person tracked when the person turns 180 degress to kinect. ie the person is not facing the kinect.

how do i track the rotation angle of the person as he/she turns away from kinect.

View 7 Replies View Related

Visual C++ :: How To Capture A Folder Address With Drag And Drop

Apr 24, 2013

I am certain that this is possible, but cannot figure out how to do it.

View 7 Replies View Related

Visual C++ :: Address Of Entry Point In Binary File?

Dec 28, 2013

How can I find/calculate the address of the entry point for an exe binary file using its PE32 optional header?

I have added a picture, where it says (file addr) thats the address I want to know how to calculate

View 2 Replies View Related

C++ :: Selecting Elements From A Group?

Jul 16, 2013

I have N vectors which look like this:

[1→m] [m+1→2m] [2m+1→3m] [3m+1→4m] [4m+1→5m]..... [{(N-1)m}+1→Nm]

I want to select 1 element from each vector without duplication of any combinations.

Essentially only when all combinations are done with 1st element in first vector ,only then it should move to next element in first vector say i have elements :[123] [456] [789]

my combinations should be like

147
148
149
157
158
159
167
168
169
247….

Also, i need no repetitions and only after all combinations of 1 are done only then the loop has to move to next combination ie 247 combination and so on.

i tried NCK (n choose k) command but it gave me random combinations.how should i go about it with using minimal for loops

View 1 Replies View Related

C :: How To Declare A Group Of Arrays Of Different Sizes

Oct 15, 2013

I'm building a box to take in several arrays of different lengths. one group happens every 10 seconds. one of them happens every 5 seconds. this is from a weather station.

10 sec
subgroupA[14]
subgroupB[24]
subgroupC[17]
subgroupD[12]
subgroupE[34]

5 sec
subgroupC[17]

I plan to retransmit them, substantially unchanged at a lesser rate to save radio power over a serial data link. buried in groupD, I want to change a few chars before retransmit.

I don't want to go to the trouble of doing a structure for each of them since most will be resent unchanged. some entries are chars, some are decimal, some are a mix. I guess it might be convenient to further define groupD, maybe not.

what is the best way to declare the group? I want them to be contiguous since that's how they will end up in the tx buffer. Each subgroup has its own checksum, so I planned it this way to make checksum more convenient.

View 6 Replies View Related

C :: Generate And Print Subsets Of A Group

Dec 13, 2014

I'm a beginner in C programming and I've got a task that can't finish it..I'm supposed to generate and print the subsets of a group that its size I should enter. Pointers are not allowed!!

View 1 Replies View Related

C++ :: Separating Prime Numbers In Group

May 25, 2013

I currently need separating my Prime numbers in group for my assignment. I absolutely do not know how to do this. I am able to find out if the number I used is prime and see how many prime number there are between 1-100 and then 1-1000 (168 primes) and so on. The thing that I need to do is find the number of prime numbers between 101-200, 201-300, 301-400, and so on until 901-100 and have it show on screen. Here is the exact assignment that I’m supposed to find out:

Assignment:

Write a C++ program to calculate and display the number of primes from 1 to 100,000, separated in groups of 100, 10 groups per line. To be more precise, on the first line of output, display the number of primes between 1 and 100, 101 and 200, etc., up to 901 to 1000. Then display the average primes per group. For example, there are 168 primes from 1 to 1000, so the average number of primes per group of 100 (or percentage) is 16.8. Then repeat the process for the groups of 100 between 1001 to 1100, 1101 to 1200, etc., for all groups of 1000 all the way up to 100,000. Your results should be as presented below, under testing.

Testing:

The output of your program should be the following, according to my calculations. Each group (g1, g2, etc.) is the number of primes in a group of 100 numbers. For example in line 1, g1 is the group from 1 to 100, g2 is the group 101 to 200, etc. For line 2, g1 is the group 1001 to 1100, g2 is 1101 to 1200, and g10 is the group from 1901 to 2000.

g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 Average Primes
----------------------------------------------------------------
25 21 16 16 17 14 16 14 15 14 16.8 for 1 to 1000
16 12 15 11 17 12 15 12 12 13 13.5 for 1001 to 2000
14 10 15 15 10 11 15 14 12 11 12.7 for 2001 to 3000
12 10 11 15 11 14 13 12 11 11 12.0 for 3001 to 4000



7 10 5 10 7 11 7 6 11 8 8.2 for 97001 to 98000
7 5 9 9 11 8 7 8 12 11 8.7 for 98001 to 99000
8 11 8 8 7 9 8 10 10 8 8.7 for 99001 to 100000

Total number of primes from 1 to 100000: 9592
Average primes per 1000: 95.92
Percentage of primes from 1 to 100000: 9.59

Here is my code that I have done so far:

#include <iostream>
#include <string>
#include <cmath>
using namespace std;
bool isPrime(long candidate);
long primeCount (long start, long end);

[Code] ....

View 8 Replies View Related

C++ :: Hold Group Of Variables In One Variable

Oct 4, 2014

So far i know that the pointer is address value to the real variable. Pointer size depends on operation system right?

for example
32bit systems: 4byte pointers
64bit systems: 8byte pointers
128bit systems: 16byte pointers?

Anyways, there have to be an variable type in c++ what can hold a pointer.

Let's imagine that the int is the thing im looking for

struct stc1 {
char *chars;
int ints;
}
struct stc2 {
char *chars;
float floats;

[Code]....

My wish is to hold different types of variable or groups of different type of variables in one variable.

I am developing program in windows now yet it will be used in linux and who knows with what x bit systems.

View 2 Replies View Related

C Sharp :: How To Give Scroll Bar For Group Box

Oct 11, 2012

Is there any methods to add scroll bar for group box

My code scenerio is: I have many groupbox in form, all group box will be appears in same place and also height and width is fixed. I'm doing group box visible true/false according to condition.

So some groupbox ecxeeds the width and heighto so I want to put this all in scroll Bar

View 2 Replies View Related

C++ :: How To Enable Array To Count Items From A Group

Dec 27, 2013

Arrays are by far the most fun to work with and I really need see if its possible to enable an array to count apples, pears, peaches, from a group of three each.

If any of the fruit groups were chosen how might an algorithm be put together to count how many were chosen from each group. But lets take into consideration that these fruit groups are not supposed to be randomly generated, instead they belong as an array with certain amount of chosen occurrences. To show how many fruits were chosen from each group example, 1 from group 1, 2 from group 2, 3 from group 3 the out put is the important part because it shows the group and the occurrence of that group. the algorithm should be able to display the group with an occurrence as well

View 1 Replies View Related

C++ :: Write Program That Reads Group Of Chars?

Nov 28, 2014

Write a program that reads a group of chars till $. Then, compute # of vowels, # of digits, # of word and # of special chars. Your program should display all required results.

So in what way should I do it? Loop, array, ...?

View 13 Replies View Related

Visual C++ :: File Stream Change Its Address During Writing Text Contents To The Stream

Apr 29, 2013

I wrote a program to write text contents to file stream through fputs, the file stream address was changed in the middle of writing text content to the stream (11% text content have been put into the file stream), that cause the file stream pointer can be evaluated problem and raise exception on stream validation code in fputs library function, my question is what things could go wrong to make file stream pointer changed its address to something else or a NULL pointer if the file stream have not been flushed and closed.

View 5 Replies View Related

C++ :: Reading Group Of Numbers Per Line In Text File

Mar 27, 2013

I am working on a project for school that has us read in a text file that contains 8 lines of SSN and grades. I am not sure how to go about reading in the lines and differentiate between the SSN and grades in the calculations.

View 1 Replies View Related

C++ :: Array To Template Class - Finding Largest Number From A Group Of Numbers

Sep 26, 2013

I'm trying to make an array that takes a group of numbers and finds the largest number into a template class.

template<class TYPE>
void Integers(TYPE data) {
int integers[] = {4, 25, 32, 85, 150, 12, 98, 200};
int i = 0;
int Max=integers[0];
for (i=1; i < 8; i++) {

[Code] ....

I'm sure I'm going about it all wrong, but I'm not sure as to get it so that it will accept the arrays input.

View 2 Replies View Related

C Sharp :: Linq - How To Group Values Week Wise And Store In Another Datatable

Apr 9, 2013

I have a datatable which comprises values from 1st January to march, something like this:

DataTable datatable = new DataTable("Employee");
datatable.Columns.Add("Date", typeof(string));
datatable.Columns.Add("Employee", typeof(string));
datatable.Columns.Add("Job1", typeof(double));
datatable.Columns.Add("Job2", typeof(double));  
datatable.Rows.Add(new Object[] { "1/4/2013", "A", 1.3, 2 });

[Code] ....

The result should look like this for Job1:

Employee 1/7-1/13 1/14-1/20 1/21-1/27 1/28-2/3 and so on...
A sum of values for this 7 days
B
C
D

I want to add all the values of Job1 for each employee in a time range which is one week starting from monday to sunday. How can I group the Job1 values week wise and store them in another datatable.

View 4 Replies View Related

C++ :: SDL Won't Detect Debugger

Sep 2, 2013

Current compiler doesn't have correctly defined debugger!

ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.

ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.

Create new parser for project 'Test'

Project 'Test' parsing stage done!

View 4 Replies View Related

C :: How To Define The Lock Detect

Feb 24, 2013

It is my first time in use lock detect so i didn't now how to start.

how to define the lock detect?

View 4 Replies View Related

C :: Detect Mouse Movement

Aug 17, 2013

i was trying to write a program in c language which can detect mouse movement, but the program which i have written can only detect the mouse click or scroll the program which i have written given below..

Code:

#include<stdio.h>
#include<string.h>
#include <ncurses.h>
int main() {
}

[code]....

run the programme with linked-lncurses. improve my program which also detect when the mouse moves.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved