C# :: PictureBox To Memory Stream In Socket?

Mar 7, 2014

I Was Try To Change PictureBox To The Memory Stream And Then I Read Memory Stream Bytes And I Send Over The Netwrok Here Is Code

MemoryStream ms = new MemoryStream();
pictureBox1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); // we save the image in side the Memory strem
byte[] pic_array = new byte[ms.Length];
ms.Position = 0;
ms.Read(pic_array, 0, pic_array.Length); //

[Code]...

but when i want get the Data o mean Bytes from Network tream How can i save in memory stream then dispaly in the picture box ? i try some thing but it is gave me error !

Socket handlerSocket = (Socket)alSockets[alSockets.Count - 1];
NetworkStream networkStream = new
NetworkStream(handlerSocket);
int thisRead = 0;
int blockSize = 1024;

[Code]...

View 2 Replies


ADVERTISEMENT

C# :: Make A Picturebox Move Inside Another Picturebox From Left To Right

Mar 3, 2014

I'm currently reading/programming from "Head first C#" book. I have this project which is making a program that has four dogs which race and there are three players that can bet on the race. I need to learn how to make the "dogs" (picture boxes) move from left end to the right end of a picture box.

Here is the code:

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

[Code].....

View 2 Replies View Related

C Sharp :: Socket Server Memory Keeps On Increasing

Apr 23, 2012

We have socket server which is developed in c# .net 3.5.

I see server memory keep on increasing whenver client disconnectes and connects.The server disconnects client if client didn;t send valid credentials.

When client is trying to connect with invalid credentials the memory is keep on increasing.

Here is the code that handles disconnection.

try {  
                            if (state.workSocket != null)  {
                                log.DebugFormat("ssl socket displose,{0},{1}", Doomed, IP);
                                state.workSocket.Shutdown(SocketShutdown.Both);
                                state.workSocket.Close(1);
                                state.workSocket = null;
                                log.DebugFormat("ssl socket displose complete,{0},{1}", Doomed, IP);
                    
[Code] ....

View 7 Replies View Related

C++ :: Overloading Stream Operator - Return Memory Address Instead Object

Jul 26, 2012

Try to implement overloading << operator. If I done it void then everything work fine (see comment out) if I make it class of ostream& then the operator return to me some memory address.

Code:
#ifndef Point_HPP // anti multiply including gates
#define Point_HPP
#include <sstream>
class Point {
private:// declaration of private data members
double x;// X coordinate
double y;// Y coordinate

[Code] .....

View 7 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# :: Could Not Find File PictureBox

Mar 24, 2015

I am working with windows mobile 6.5 and sql compact, trying to create application to save pic on database but when i try to save pic that loaded to picturebox it giving this error "could not find file 'picturebox" and in windows mobile we don't have imagelocation property and this is code that i use it

using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;

[code]....

View 3 Replies View Related

C# :: Picturebox Size In Parent Container

Aug 22, 2014

I have a picture box, inside a table layout panel. The default size for the picture box is 456, 457. However, what I want to do is have the picture box be the size of the available area, even if the form is full screen.

I have the picture box dock set to fill etc. but not matter what I do, it refuses to change the dimensions from the ones above.

The only work around I could find that worked was this:

this.pbMainMap.Size = new Size(Screen.GetWorkingArea(this).Width, Screen.GetWorkingArea(this).Height);

Which is pretty useless if you are using a table layout panel. Can I grab the dimensions from the cell I am in or something?

View 4 Replies View Related

C# :: Using Combobox To Change Image In Picturebox?

Jun 13, 2014

I've been working on making a sprite generator and this is one thing that has kept giving me difficulties. No matter what I've looked up nothing directly says how to nor can I find anything on a similar topic to try and apply to it either. I know how to add the resources and names for the options but how do I get the options to make my picturebox image change in relation to the selection?

View 4 Replies View Related

C Sharp :: Viewing A DICOM In A PictureBox?

Feb 5, 2014

I've been looking for a C# library that is well documented and can show DICOM (medical CT scan data, including the image) as jpeg/bmp data that is viewable in a PictureBox.

I've only found OpenDicom which is more or less unsupported now and EvilDicom - whose owner has made some significant changes to it, making all existing stack overflow questions on it irrelevant.

View 1 Replies View Related

C# :: Retrieve Image From Database And Display In Picturebox

Sep 18, 2014

I am creating an employee details project, the image is getting stored in the database but i am not able display it in the picture box.

private void button1_Click(object sender, EventArgs e) {
SqlConnection con = new SqlConnection(Connectionstring);
con.Open();
SqlCommand cmd = new SqlCommand("select photo from emprecordtable where eid='"+comboBox1.Text+"'", con);
//SqlDataAdapter da = new SqlDataAdapter(cmd);
//DataSet ds = new DataSet();

[code] ....

In sql server i have table called emprecordtable and i have the fields eid, rfid, empname, designation, phno, addres, and photo which is the image field and i have given the datatype as image but in the database the image is getting stored as Binary Data.. So, how to display in the picturebox from the database.

View 11 Replies View Related

C# :: Draw Multiple Rectangles With Mouse In Picturebox

Jun 6, 2014

I am trying to build a WinForm application that will allow you to load an image into a picturebox and then draw multiple rectangles (empty or translucent) to kind of highlight areas. I want all the rectangles to stay on the image (i can take care of a clear method later). The code below has the latest two attempts I've tried. One is all commented out and the other is not. Both will load the image just fine but neither will allow me to draw/select rectangles on the image.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;

[Code] ....

View 14 Replies View Related

C Sharp :: Saving Picturebox Image With Graphics In It

Aug 23, 2013

What i'm trying to do is load an image from my database create some graphics to it. probably just some lines and marks and save it back to my database. here's so far what I got.
 
for creating graphics:  
 } private void pictureBox3_MouseDown(object sender, MouseEventArgs e) {
            draw = true;
        } private void pictureBox3_MouseMove(object sender, MouseEventArgs e)  {
            if (draw)  {
                Graphics g = Graphics.FromImage(pictureBox3.Image);
 
[Code] ....

but the saving part doesnt work :( I think it only saves the image loaded to the picturebox but not the graphics created to it. how to merge it? i've tried to google it and found some sort of same cases but fails to make it work, something like converting it to bitmap.

View 2 Replies View Related

C Sharp :: Motion Of Controls - Picturebox Position In Form?

Apr 8, 2012

I have a form with a picturebox and some buttons to move the picturebox. I don't want the user to guide the picturebox out of the form even by dragging the form border picturebox moves just in the form border, and also there is a button to guide the picturebox to the start position (start choose by user). What can i do?

View 1 Replies View Related

C :: UDO Socket Programming

Dec 18, 2014

I am trying to test my client-server socket program wherein the client connects to the server,client sends a message, server receives it and echo back to the client.So far, in the program server receives the message from the client, prints it BUT when it tries to send the message back to the client it shows an error.

sendto(): Invalid argument.I am new to socket programming.

Code:

//Server
#include<stdio.h> //printf
#include<string.h> //memset
#include<stdlib.h> //exit(0)
#include<netinet/in.h>
#include<sys/socket.h>
#define BUFLEN 512 //Max length of buffer
#define PORT 10003 //The port on which to listen for incoming data
}

[code]....

View 3 Replies View Related

C++ :: UDP Socket Library On Linux

Jan 29, 2014

I'm attempting to write a little UDP socket library in c++ on linux so a user can just create a new instance of a UDPSocket class, specify destination ip and port, and just connect. Then the user should be able to call send() or receive() in any order they want.. and here I encounter a little problem..

Most of the tutorials for udp socket sending out there include a bind() call when you create your "server" that is supposed to receive data, but the code that send data does not need one. Because I also want my library to support unicast/broadcast/multicast, I have read that I need to set the socket option SO_REUSEADDR on my sockets (since multiple sockets will need to be connected to same destination IP/port for broadcast/multicast)

My question is.. do I need to create 2 socket handles per "UDPSocke in order to make this work? One for sending and one for receiving data? In my code when I try to work with only 1 socket, it is only able to receive stuff from itself on unicast.. Or should I just remove the SO_REUSEADDR when in unicast mode, then try to bind with both sockets, accept that the bind will only work on the 1st socket, and take it from there?

View 1 Replies View Related

C :: Sending Matrix Over UDP Socket

May 18, 2014

I want to apply program to send matrix from client and server ,and return back a processed matrix ..

How I can do it using UDP ,it was easy to use tcp for that!?

View 3 Replies View Related

C :: Sending Integer Via Socket

Dec 18, 2014

Verify my Method . I am not getting expected output ..

Code:

int Amount=500;
send(newSocket,Amount,4,0);
close(welcomeSocket);
recv(clientSocket,Amount,4,0);
// Amount= ntohl(Amount);
printf("Data received: %d",atoi(Amount[0]));

View 5 Replies View Related

C :: Socket Programming Getting Segfault

May 22, 2013

I am trying to send a packet across a client/server communication. I am getting a seg fault (while running the program(It compiles fine)) when I try to read the neighbor file, You should be able to see this below the comment /***** Read neighbor file***/ :

Code:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
}

[code]....

View 2 Replies View Related

C++ :: How To Multithread Socket Serve

Feb 19, 2013

I'm having a bit of trouble learning how to multithread a socket server. I have everything working perfectly fine, but it only accepts one client (I would like multiple clients). some sort of example (I have troubles understanding some things, unless its visual).

View 4 Replies View Related

C# :: Tcp Socket Buffer Size?

Dec 17, 2014

get some opinions on, or established methods on how your buffer size should be decided.

View 2 Replies View Related

C++ :: Struct Of Ints Via Socket?

Feb 7, 2014

I have some paper work to do about a game I should be able to play with my class mates. We should be able to send and recive a struct concerning about the 'moves' of the pieces at the game. This struct is made of 4 ints, simple as that.

I had a previous paper work to do where I'd have to send ints and that was ok, but now that I have to send a struct I'm failing to do so. This is What I've tried:

//SERVER
struct message{
int code;
int piece;
int x;
int y;
}send;
bytes_sent=write(new_socket,&send,sizeof(message));
cout<<bytes_sent;

So far so good, I see 16 as bytes_sent's value.

On the other hand:

//CLIENT
struct message{
int code;
int piece;
int x;
int y;
}recive;
bytes_recvd=read(my_socket,&recive,sizeof(message));
cout<<bytes_recvd;

I always see 0 as the bytes_recvd's value.

View 3 Replies View Related

C# :: Socket TCP Send / Receive

Jun 28, 2014

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace test {

[Code] ....

I don't know if this is a bug in Winsock or the .NET Framework but i need to fix this or workaround. Recently I was working on a networking class and this error is breaking everything.

If you add Thread.Sleep(1) after Send() call then "TCP Bug detected" doesnt get executed but its not a reliable fix.

View 7 Replies View Related

C/C++ :: How To Send Many Images Through Socket

Jun 25, 2012

I have written a socket witch send an image 256x256 and now i want to send many images and i don't know what loop to write to make the socket after have sent the first image to send another and not to write the same program many times for every image ......

this is the part that read the binary image

if( !(fp=fopen("Anemos.bmp","rb"))) {
            printf("Unable to load bin file: %s...
","Anemos.bmp");

[Code] ....

View 2 Replies View Related

C :: Socket Programming And Console Control

Jan 4, 2014

I would like to make a program for final project, which can let me send any file to my computer at home, and i can access any files in my computer when i am not at home.sending and getting file will be with socket programming.

i would like to reach all folders in computer, not only the folder, where client program exist. how can i access other folders at remote computer by using my program?

View 4 Replies View Related

C++ :: HTTP Response Receive Using Socket

May 18, 2014

I make a simple c++ http post request using socket and it is working fine. But how to get only the message of the response. Here is my receive code:

char buffer[1028];
recv(socket, buffer, sizeof(buffer), 0);
printf("%s", buffer);

Then here is the response that the http send back.

HTTP/1.1 200 OK
Data: Mon, 19 May 2014 12:46:36 GMT
Server: Apache/2.4.9 (Win32) OpenSSL/0.9.8y PHP/5.4.27
X-Powered-By: PHP/5.4.27
Coneten-Length: 28
Content-Type: text/html

All done! Do some stuff now. So what I want to try is get 3 things in this response and put them to string vector but how to do this. What I need is to parse the response and the 200 OK, 28 and All done! Do some stuff now. then put them to string vector.

expected result

response[0] = 200 OK;
response[1] = 28
response[2] = All done! Do some stuff now

View 2 Replies View Related

C/C++ :: Set Timeout On A Socket Using Select Function

Mar 24, 2014

As requested by an exercise I have to write a function which:

- takes as parameter 1 unsigned which represent a timout value, 1 string which represent an IP address and an array containing port's numbers
- sends an UDP packet (1024 byte with NULL content) to each pair <IP,port>
- waits for the first reply, if it receives a packet within the timeout (set by select() function), the function returns the port of the process who replied, else it returns -1

I think I can do anything of above, but I've not understood how to set and use the select() in this case.

This is my code as it is at the moment

#define BUFLEN 1024
int comUDP ( unsigned timeout, char* ip, int ports[] ) {
int s_ds_sock, c_ds_sock;
struct sockaddr_in server_socket, client_socket;
char msg[BUFLEN] = NULL; //message to send to the clients
fd_set fds;

[Code] .....

View 2 Replies View Related







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