Search Results

Search found 21090 results on 844 pages for 'webservices client'.

Page 12/844 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • FTP client to zip before upload and unzip on the server after upload

    - by Ronaldo Junior
    I am always working with some big websites that is annoying to upload given the number of small files. I use Filezilla but am happy to buy some commercial solution if there is one out there that can zip the files before upload and then unzip it after upload. Its a pain to have to manually do that all the time. If someone know of any ftp client or extension for Filezilla or other that would do that... I sent an email to the support for CuteFTP and WSFtp - no answer so far... I know FTP protocol does not allow this command - thats why Im asking for a extension (if anyone know) or a free or commercial FTP client that do the job...

    Read the article

  • MVC3/Razor Client Validation Not firing

    - by Jason Gerstorff
    I am trying to get client validation working in MVC3 using data annotations. I have looked at similar posts including this MVC3 Client side validation not working for the answer. I'm using an EF data model. I created a partial class like this for my validations. [MetadataType(typeof(Post_Validation))] public partial class Post { } public class Post_Validation { [Required(ErrorMessage = "Title is required")] [StringLength(5, ErrorMessage = "Title may not be longer than 5 characters")] public string Title { get; set; } [Required(ErrorMessage = "Text is required")] [DataType(DataType.MultilineText)] public string Text { get; set; } [Required(ErrorMessage = "Publish Date is required")] [DataType(DataType.DateTime)] public DateTime PublishDate { get; set; } } My cshtml page includes the following. <h2>Create</h2> <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> @using (Html.BeginForm()) { @Html.ValidationSummary(true) Post <div class="editor-label"> @Html.LabelFor(model => model.Title) </div> <div class="editor-field"> @Html.EditorFor(model => model.Title) @Html.ValidationMessageFor(model => model.Title) </div> <div class="editor-label"> @Html.LabelFor(model => model.Text) </div> <div class="editor-field"> @Html.EditorFor(model => model.Text) @Html.ValidationMessageFor(model => model.Text) Web Config: <appSettings> <add key="ClientValidationEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" /> Layout: <head> <title>@ViewBag.Title</title> <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" /> <script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script> So, the Multiline Text annotation works and creates a text area. But none of the validations work client side. I don't know what i might be missing. Any ideas?? i can post more information if needed. Thanks!

    Read the article

  • Solutions for redundant server and client code?

    - by Fragsworth
    In our system, the code which exists on the client side (in Flash and Javascript) mirrors the code that exists on the server side (e.g. in Python or PHP), normally with respect to the models, the methods available for those models, and the unit tests written for them. This becomes a problem in systems where you want to minimize data transfer (e.g. multiplayer games). I do not want to write the same code and unit tests redundantly for both the client and server, but I don't know of any standard solutions to deal with this. Basically, I want a language/compiler which can produce models and methods for three main languages: Actionscript, Javascript, and any server language. Does something like this exist?

    Read the article

  • Strategies for "Always-Connected" Windows Client Data Architecture

    - by magz2010
    Hi. Let me start by saying: this is my 1st post here, this is a bit lenghty, and I havent done Windows Forms development in years....with that in mind please excuse me if this isn't directly a programming question and please bear with me as I really need the help!! I have been asked to develop a Windows Forms app for our company that talks to a central (local area network) Linux Server hosting a PostgreSQL database. The app is to allow users to authenticate themselves into the system and thereafter conduct the usual transactions with the PG database. Ordinarily, I would propose writing a webforms app against Mono, but the clients need to utilise local resources such as USB peripheral devices, so that is out of the question. While it might not seem clear, my questions are italised below: Dilemma #1: The application is meant to be always connected. How should I structure my DAL/BLL - Should this reside on the server or with the client? Dilemma #2: I have been reading up on Client Application Services (CAS), and it seems like a great fit for authentication, as everything is exposed via URIs. I know that a .NET Data Provider exists for PostgreSQL, but not too sure if CAS will all work on a Linux (Debian) server? Believe me, I would get my hands dirty and try myself, but I need to come up with a logical design first before resources are allocated to me for "trial purposes"! Dilemma #3: If the DAL/BLL is to reside on the server, is there any way I can create data services, and expose only these services to authenticated clients. There is a (security) requirement whereby a connection string with username and password to the database cannot be present on any client machines...even if security on the database side is quite rigid. I'm guessing that the only way for this to work would be to create the various CRUD data service methods that are exposed by an ASP.NET app, and have the WindowsForms make a request for data or persist data to the ASP.NET app (thru a URI) and have that return a resultset or value. Would I be correct in assuming this? Should I be looking into WCF Data Services? and will WCF work with a non-SQL Server database? Thank you for taking the time out to read this, but know that I am desperately seeking any advice on this! THANKS A MILLION!!!!

    Read the article

  • SQL Native Client 10 Performance miserable (due to server-side cursors)

    - by namezero
    we have an application that uses ODBC via CDatabase/CRecordset in MFC (VS2010). We have two backends implemented. MSSQL and MySQL. Now, when we use MSSQL (with the Native Client 10.0), retrieving records with SELECT is dramatically slow via slow links (VPN, for example). The MySQL ODBC driver does not exhibit this nasty behavior. For example: CRecordset r(&m_db); r.Open(CRecordset::snapshot, L"SELECT a.something, b.sthelse FROM TableA AS a LEFT JOIN TableB AS b ON a.ID=b.Ref"); r.MoveFirst(); while(!r.IsEOF()) { // Retrieve CString strData; crs.GetFieldValue(L"a.something", strData); crs.MoveNext(); } Now, with the MySQL driver, everything runs as it should. The query is returned, and everything is lightning fast. However, with the MSSQL Native Client, things slow down, because on every MoveNext(), the driver communicates with the server. I think it is due to server-side cursors, but I didn't find a way to disable them. I have tried using: ::SQLSetConnectAttr(m_db.m_hdbc, SQL_ATTR_ODBC_CURSORS, SQL_CUR_USE_ODBC, SQL_IS_INTEGER); But this didn't help either. There are still long-running exec's to sp_cursorfetch() et al in SQL Profiler. I have also tried a small reference project with SQLAPI and bulk fetch, but that hangs in FetchNext() for a long time, too (even if there is only one record in the resultset). This however only happens on queries with LEFT JOINS, table-valued functions, etc. Note that the query doesn't take that long - executing the same SQL via SQL Studio over the same connection returns in a reasonable time. Question1: Is is possible to somehow get the native client to "cache" all results locally use local cursors in a similar fashion as the MySQL driver seems to do it? Maybe this is the wrong approach altogether, but I'm not sure how else to do this. All we want is to retrieve all data at once from a SELECT, then never talk the server again until the next query. We don't care about recordset updates, deletes, etc or any of that nonsense. We only want to retrieve data. We take that recordset, get all the data, and delete it. Question2: Is there a more efficient way to just retrieve data in MFC with ODBC?

    Read the article

  • Client Profile Application prerequisites

    - by Carlo
    One last question about Client Profile installation. I downloaded the Microsoft .NET Framework Client Profile Online Installer because we want to put it in the installation CD because our end user might not have either .net framework 3.5 or internet. So we want to be able to handle both cases. In the prerequisites I'm able to select the location of where the file will be, but I don't know where it should be. I want to be able to somehow put the path of the cd, something like d:\ProductName\Prerequisites\DotNetFx35ClientSetup.exe so it can get it and install it from there. Does anyone have an idea of how this can be achieved? Thank you. Here's the prerequisites window:

    Read the article

  • Clickonce + .net client profile 4 framework + offline

    - by grimmersnee
    Hi, I have a windows form project using VS2010 and I am deploying using clickonce. I need the application to work offline as well as online. I have configured the prerequisite - .net client profile 4 and set the location to the same as the application. Everything seems to work as expected, but upon testing I have found it takes 5+ minutes to install the .net client profile 4 and it also requires a reboot. Why does it take so long to install offline (I thought this was going to be mega fast like promised? And why does it require a reboot!!!!????

    Read the article

  • C# Client-Server implementation error on client's socket

    - by Ksice
    I'm trying to launch my client. Server already runned on the same computer. So I'm using "localhost" with GetHostEntry: IPHostEntry ipHostInfo = System.Net.Dns.GetHostEntry("localhost"); IPAddress ipAddress = ipHostInfo.AddressList[0]; IPEndPoint remoteEP = new IPEndPoint(ipAddress, Port); But I have this "no connection could be made because the target machine actively refused it" error. What is the reason? Could it be because ipHostInfo.AddressList[0] is an IPv6? How then I can accept Ipv4 address?

    Read the article

  • SignalR cannot read property client of undefined

    - by polonskyg
    I'm trying to add SignalR to my project (ASPNET MVC 4). But I can't make it work. In the below image you can see the error I'm receiving. I've read a lot of stackoverflow posts but none of them is resolving my issue. This is what I did so far: 1) Ran Install-Package Microsoft.AspNet.SignalR -Pre 2) Added RouteTable.Routes.MapHubs(); in Global.asax.cs Application_Start() 3) If I go to http://localhost:9096/Gdp.IServer.Web/signalr/hubs I can see the file content 4) Added <modules runAllManagedModulesForAllRequests="true"/> to Web.Config 5) Created folder Hubs in the root of the MVC application 6) Moved jquery and signalR scripts to /Scripts/lib folder (I'm not using jquery 1.6.4, I'm using the latest) This is my Index.cshtml <h2>List of Messages</h2> <div class="container"> <input type="text" id="message" /> <input type="button" id="sendmessage" value="Send" /> <input type="hidden" id="displayname" /> <ul id="discussion"> </ul> </div> @section pageScripts { <!--Reference the SignalR library. --> <script src="@Url.Content("~/Scripts/jquery.signalR-1.0.0-rc1.min.js")" type="text/javascript"></script> <!--Reference the autogenerated SignalR hub script. --> <script type="text/javascript" src="~/signalr/hubs"></script> <script src="@Url.Content("~/Scripts/map.js")" type="text/javascript"></script> } This is my IServerHub.cs file (located inside Hubs folder) namespace Gdp.IServer.Ui.Web.Hubs { using Microsoft.AspNet.SignalR.Hubs; [HubName("iServerHub")] public class IServerHub : Hub { public void Send(string name, string message) { Clients.All.broadcastMessage(name, message); } } } And this is map.js $(function () { // Declare a proxy to reference the hub. var clientServerHub = $.connection.iServerHub; // Create a function that the hub can call to broadcast messages. clientServerHub.client.broadcastMessage = function (name, message) { $('#discussion').append('<li><strong>' + name + '</strong>:&nbsp;&nbsp;' + message + '</li>'); }; // Get the user name and store it to prepend to messages. $('#displayname').val(prompt('Enter your name:', '')); // Set initial focus to message input box. $('#message').focus(); // Start the connection. $.connection.hub.start().done(function () { $('#sendmessage').click(function () { // Html encode display name and message. var encodedName = $('<div />').text($('#displayname').val()).html(); var encodedMsg = $('<div />').text($('#message').val()).html(); // Call the Send method on the hub. clientServerHub.server.send(encodedName, encodedMsg); // Clear text box and reset focus for next comment. $('#message').val('').focus(); }); }); }); The DLL's I see references for SignalR are: Microsoft.AspNet.SignalR.Core Microsoft.AspNet.SignalR.Owin Microsoft.AspNet.SignalR.SystemWeb Any ideas how to get it work? Should I make any change because the scripts are in /Script/lib folder? NOTE I'm following the instruction found here on how to set up Windsor Castle to make it work with SignalR, and again, seems that the proxy cannot be created and I'm getting the same error: Cannot read property client of undefined meaning that the proxy to the hub was not created This is how I have it in the server public class IncidentServerHub : Hub and like this in the client var clientServerHub = $.connection.incidentServerHub; Again, I can see the dynamically created file here: /GdpSoftware.Server.Web/signalr/hubs So, Why the proxy is not created? Thanks in advance!!! Guillermo.

    Read the article

  • Problem in transfering file from server to client using C sockets

    - by coolrockers2007
    I want to ask, why I cannot transfer file from server to client? When I start to send the file from server, the client side program will have problem. So, I spend some times to check the code, But I still cannot find out the problem Can anyone point out the problem for me? CLIENTFILE.C #include stdio.h #include stdlib.h #include time.h #include netinet/in.h #include fcntl.h #include sys/types.h #include string.h #include stdarg.h #define PORT 5678 #define MLEN 1000 int main(int argc, char *argv []) { int sockfd; int number,message; char outbuff[MLEN],inbuff[MLEN]; //char PWD_buffer[_MAX_PATH]; struct sockaddr_in servaddr; FILE *fp; int numbytes; char buf[2048]; if (argc != 2) fprintf(stderr, "error"); if ( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) fprintf(stderr, "socket error"); memset(&servaddr, 0, sizeof(servaddr)); servaddr.sin_family = AF_INET; servaddr.sin_port = htons(PORT); if (connect(sockfd, (struct sockaddr *) &servaddr, sizeof(servaddr)) < 0) fprintf(stderr, "connect error"); if ( (fp = fopen("/home/na/nall9047/write.txt", "w")) == NULL){ perror("fopen"); exit(1); } printf("Still NO PROBLEM!\n"); //Receive file from server while(1){ numbytes = read(sockfd, buf, sizeof(buf)); printf("read %d bytes, ", numbytes); if(numbytes == 0){ printf("\n"); break; } numbytes = fwrite(buf, sizeof(char), numbytes, fp); printf("fwrite %d bytes\n", numbytes); } fclose(fp); close(sockfd); return 0; } SERVERFILE.C #include stdio.h #include fcntl.h #include stdlib.h #include time.h #include string.h #include netinet/in.h #include errno.h #include sys/types.h #include sys/socket.h #includ estdarg.h #define PORT 5678 #define MLEN 1000 int main(int argc, char *argv []) { int listenfd, connfd; int number, message, numbytes; int h, i, j, alen; int nread; struct sockaddr_in servaddr; struct sockaddr_in cliaddr; FILE *in_file, *out_file, *fp; char buf[4096]; listenfd = socket(AF_INET, SOCK_STREAM, 0); if (listenfd < 0) fprintf(stderr,"listen error") ; memset(&servaddr, 0, sizeof(servaddr)); servaddr.sin_family = AF_INET; servaddr.sin_addr.s_addr = htonl(INADDR_ANY); servaddr.sin_port = htons(PORT); if (bind(listenfd, (struct sockaddr *) &servaddr, sizeof(servaddr)) < 0) fprintf(stderr,"bind error") ; alen = sizeof(struct sockaddr); connfd = accept(listenfd, (struct sockaddr *) &cliaddr, &alen); if (connfd < 0) fprintf(stderr,"error connecting") ; printf("accept one client from %s!\n", inet_ntoa(cliaddr.sin_addr)); fp = fopen ("/home/na/nall9047/read.txt", "r"); // open file stored in server if (fp == NULL) { printf("\nfile NOT exist"); } //Sending file while(!feof(fp)){ numbytes = fread(buf, sizeof(char), sizeof(buf), fp); printf("fread %d bytes, ", numbytes); numbytes = write(connfd, buf, numbytes); printf("Sending %d bytes\n",numbytes); } fclose (fp); close(listenfd); close(connfd); return 0; }

    Read the article

  • SharePoint 2010 - Client Object Model - Add attachment to ListItem

    - by Thorben
    Hi, I have a SharePoint List to which I'm adding new ListItems using the Client Object Model. Adding ListItems is not a problem and works great. Now I want to add attachments. I'm using the SaveBinaryDirect in the following manner: File.SaveBinaryDirect(clientCtx, url.AbsolutePath + "/Attachments/31/" + fileName, inputStream, true); It works without any problem as long as the item that I'm trying to add the attachment to, already has an attachment that was added through the SharePoint site and not using the Client Object Model. When I try to add an attachment to a item that doesnt have any attachments yet, I get the following errors (both happen but not with the same files - but those two messages appear consistently): The remote server returned an error: (409) Conflict The remote server returned an error: (404) Not Found I figured that maybe I need to create the attachment folder first for this item. When I try the following code: clientCtx.Load(ticketList.RootFolder.Folders); clientCtx.ExecuteQuery(); clientCtx.Load(ticketList.RootFolder.Folders[1]); // 1 -> Attachment folder clientCtx.Load(ticketList.RootFolder.Folders[1].Folders); clientCtx.ExecuteQuery(); Folder folder = ticketList.RootFolder.Folders[1].Folders.Add("33"); clientCtx.ExecuteQuery(); I receive an error message saying: Cannot create folder "Lists/Ticket System/Attachment/33" I have full administrator rights for the SharePoint site/list. Any ideas what I could be doing wrong? Thanks, Thorben

    Read the article

  • Java Server Client Program I/O Exception

    - by AjayP
    I made this program: http://java.sun.com/docs/books/tutorial/networking/sockets/clientServer.html And it works perfectly if I put the server's hostname as 127.0.0.1 or my computers name (Ajay-PC). However these 2 methods are LAN or local only not internet. So I changed it to my internet ip. 70.128.xxx.xxx etc. But it didn't work. I checked: canyouseeme.org and it said 4444 was CLOSED. So I did a quick port forward. Portforward: Name: My Java Program Start Port: 4444 End Port: 4444 Server IP: 10.0.0.12 <-- (Yeah this is my Local IP I checked) then I tried canyouseeme.org AGAIN: and it said 4444 was OPEN I ran my server client program and it yet to work. So my problem is the client server program is not working on the internet just locally. So something is blocking it and I don't know what. Computer: Windows Vista x64 Norton AntiVirus 2010 Thanks! I'll give best answer or whatever to who ever answers the best ;) :)

    Read the article

  • JBoss Client-Cert Authentication: Hot to setup UsersRolesLoginModule in login-config.xml

    - by sixtyfootersdude
    I am looking that chapter 8 of the RedHat, JBoss documentation. I am trying to setup Certificate Authentication as described on this page . On the page it says that the login-config file should have this in it: <application-policy name="jmx-console"> <authentication> <login-module code="org.jboss.security.auth.spi.BaseCertLoginModule" flag="required"> <module-option name="password-stacking">useFirstPass</module-option> <module-option name="securityDomain">java:/jaas/jmx-console</module-option> </login-module> <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required"> <module-option name="password-stacking">useFirstPass</module-option> <module-option name="usersProperties">jmx-console-users.properties</module-option> <module-option name="rolesProperties">jmx-console-roles.properties</module-option> </login-module> </authentication> </application-policy> I think that the BaseCertLoginModule chekcs the clients server and the UsersRolesloginModule assigns the client to role (using the file jmx-console-roles.properties). However I am completely bewildered as to what should be in this file: jmx-console-users.properties. Normally that file stores user/password pairs (source) but when using client-cert I don't think that there should be passwords in there. Right now I am leaving that file empty but I am getting this exception: [org.jboss.security.auth.spi.UsersRolesLoginModule.initialize:135] Failed to load users/passwords/role files java.io.IOException: No properties file: users.properties or defaults: defaultUsers.properties found ... What should be in that file? Thanks.

    Read the article

  • org.apache.http.conn.HttpHostConnectException:Connection to http://172.20.38.143 refused

    - by Passion
    I have developed client server Application .I am accessing mysql with php running on my machine and client running on my cell which is connected to machine.WI-FI is also switched ON. Internet Permission are also added in Manifest file but then also the i encounter error 172.20.38.143 is IP OF MY MACHINE 06-01 13:20:10.391: W/System.err(11157): org.apache.http.conn.HttpHostConnectException: Connection to http://172.20.38.143 refused 06-01 13:20:10.401: W/System.err(11157): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:183) 06-01 13:20:10.401: W/System.err(11157): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164) 06-01 13:20:10.401: W/System.err(11157): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119) 06-01 13:20:10.401: W/System.err(11157): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360) 06-01 13:20:10.401: W/System.err(11157): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:674) 06-01 13:20:10.401: W/System.err(11157): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:511) 06-01 13:20:10.401: W/System.err(11157): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:489) 06-01 13:20:10.401: W/System.err(11157): at nineandroid.net.example.library.JSONParser.getJSONFromUrl(JSONParser.java:42) 06-01 13:20:10.401: W/System.err(11157): at nineandroid.net.example.library.UserFunctions.registerUser(UserFunctions.java:59) 06-01 13:20:10.401: W/System.err(11157): at nineandroid.net.example.RegisterActivity$1.onClick(RegisterActivity.java:52) 06-01 13:20:10.411: W/System.err(11157): at android.view.View.performClick(View.java:3567) 06-01 13:20:10.411: W/System.err(11157): at android.view.View$PerformClick.run(View.java:14224) 06-01 13:20:10.411: W/System.err(11157): at android.os.Handler.handleCallback(Handler.java:605) 06-01 13:20:10.411: W/System.err(11157): at android.os.Handler.dispatchMessage(Handler.java:92) 06-01 13:20:10.411: W/System.err(11157): at android.os.Looper.loop(Looper.java:137) 06-01 13:20:10.411: W/System.err(11157): at android.app.ActivityThread.main(ActivityThread.java:4517) 06-01 13:20:10.411: W/System.err(11157): at java.lang.reflect.Method.invokeNative(Native Method) 06-01 13:20:10.411: W/System.err(11157): at java.lang.reflect.Method.invoke(Method.java:511) 06-01 13:20:10.411: W/System.err(11157): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993) 06-01 13:20:10.421: W/System.err(11157): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760) 06-01 13:20:10.421: W/System.err(11157): at dalvik.system.NativeStart.main(Native Method) 06-01 13:20:10.421: W/System.err(11157): Caused by: java.net.ConnectException: failed to connect to /172.20.38.143 (port 80): connect failed: ENETUNREACH (Network is unreachable) 06-01 13:20:10.431: W/System.err(11157): at libcore.io.IoBridge.connect(IoBridge.java:114) 06-01 13:20:10.431: W/System.err(11157): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192) 06-01 13:20:10.431: W/System.err(11157): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459) 06-01 13:20:10.431: W/System.err(11157): at java.net.Socket.connect(Socket.java:848) 06-01 13:20:10.431: W/System.err(11157): at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119) 06-01 13:20:10.431: W/System.err(11157): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144) 06-01 13:20:10.431: W/System.err(11157): ... 20 more 06-01 13:20:10.431: W/System.err(11157): Caused by: libcore.io.ErrnoException: connect failed: ENETUNREACH (Network is unreachable) 06-01 13:20:10.441: W/System.err(11157): at libcore.io.Posix.connect(Native Method) 06-01 13:20:10.441: W/System.err(11157): at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:85) 06-01 13:20:10.441: W/System.err(11157): at libcore.io.IoBridge.connectErrno(IoBridge.java:127) 06-01 13:20:10.441: W/System.err(11157): at libcore.io.IoBridge.connect(IoBridge.java:112) 06-01 13:20:10.441: W/System.err(11157): ... 25 more 06-01 13:20:10.441: E/Buffer Error(11157): Error converting result java.lang.NullPointerException 06-01 13:20:10.451: E/JSON Parser(11157): Error parsing data org.json.JSONException: End of input at character 0 of 06-01 13:20:10.451: D/AndroidRuntime(11157): Shutting down VM 06-01 13:20:10.451: W/dalvikvm(11157): threadid=1: thread exiting with uncaught exception (group=0x40c0aa68) 06-01 13:20:10.451: E/AndroidRuntime(11157): FATAL EXCEPTION: main 06-01 13:20:10.451: E/AndroidRuntime(11157): java.lang.NullPointerException 06-01 13:20:10.451: E/AndroidRuntime(11157): at nineandroid.net.example.RegisterActivity$1.onClick(RegisterActivity.java:56) 06-01 13:20:10.451: E/AndroidRuntime(11157): at android.view.View.performClick(View.java:3567) 06-01 13:20:10.451: E/AndroidRuntime(11157): at android.view.View$PerformClick.run(View.java:14224) 06-01 13:20:10.451: E/AndroidRuntime(11157): at android.os.Handler.handleCallback(Handler.java:605) 06-01 13:20:10.451: E/AndroidRuntime(11157): at android.os.Handler.dispatchMessage(Handler.java:92) 06-01 13:20:10.451: E/AndroidRuntime(11157): at android.os.Looper.loop(Looper.java:137) 06-01 13:20:10.451: E/AndroidRuntime(11157): at android.app.ActivityThread.main(ActivityThread.java:4517) 06-01 13:20:10.451: E/AndroidRuntime(11157): at java.lang.reflect.Method.invokeNative(Native Method) 06-01 13:20:10.451: E/AndroidRuntime(11157): at java.lang.reflect.Method.invoke(Method.java:511) 06-01 13:20:10.451: E/AndroidRuntime(11157): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993) 06-01 13:20:10.451: E/AndroidRuntime(11157): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760) 06-01 13:20:10.451: E/AndroidRuntime(11157): at dalvik.system.NativeStart.main(Native Method) UserFunctions.java to call jsonParser public class UserFunctions { private JSONParser jsonParser; private static String loginURL = "http://172.20.38.143/ah_login_api/"; private static String registerURL = "http://172.20.38.143/ah_login_api/"; private static String login_tag = "login"; private static String register_tag = "register"; // constructor public UserFunctions(){ jsonParser = new JSONParser(); } /** * function make Login Request * @param email * @param password * */ public JSONObject loginUser(String email, String password){ // Building Parameters List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("tag", login_tag)); params.add(new BasicNameValuePair("email", email)); params.add(new BasicNameValuePair("password", password)); JSONObject json = jsonParser.getJSONFromUrl(loginURL, params); // return json // Log.e("JSON", json.toString()); return json; } /** * function make Login Request * @param name * @param email * @param password * */ public JSONObject registerUser(String name, String email, String password){ // Building Parameters List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("tag", register_tag)); params.add(new BasicNameValuePair("name", name)); params.add(new BasicNameValuePair("email", email)); params.add(new BasicNameValuePair("password", password)); // getting JSON Object JSONObject json = jsonParser.getJSONFromUrl(registerURL, params); // return json return json; } /** * Function get Login status * */ public boolean isUserLoggedIn(Context context){ DatabaseHandler db = new DatabaseHandler(context); int count = db.getRowCount(); if(count > 0){ // user logged in return true; } return false; } /** * Function to logout user * Reset Database * */ public boolean logoutUser(Context context){ DatabaseHandler db = new DatabaseHandler(context); db.resetTables(); return true; } } jsonParser.java public class JSONParser { static InputStream is = null; static JSONObject jObj = null; static String json = ""; // constructor public JSONParser() { } public JSONObject getJSONFromUrl(String url, List<NameValuePair> params) { // Making HTTP request try { // defaultHttpClient DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); httpPost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { BufferedReader reader = new BufferedReader(new InputStreamReader( is, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); json = sb.toString(); Log.e("JSON", json); } catch (Exception e) { Log.e("Buffer Error", "Error converting result " + e.toString()); } // try parse the string to a JSON object try { jObj = new JSONObject(json); } catch (JSONException e) { Log.e("JSON Parser", "Error parsing data " + e.toString()); } // return JSON String return jObj; } } RegisterActivity.java public class RegisterActivity extends Activity { Button btnRegister; Button btnLinkToLogin; EditText inputFullName; EditText inputEmail; EditText inputPassword; TextView registerErrorMsg; // JSON Response node names private static String KEY_SUCCESS = "success"; private static String KEY_UID = "uid"; private static String KEY_NAME = "name"; private static String KEY_EMAIL = "email"; private static String KEY_CREATED_AT = "created_at"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.register); // Importing all assets like buttons, text fields inputFullName = (EditText) findViewById(R.id.registerName); inputEmail = (EditText) findViewById(R.id.registerEmail); inputPassword = (EditText) findViewById(R.id.registerPassword); btnRegister = (Button) findViewById(R.id.btnRegister); btnLinkToLogin = (Button) findViewById(R.id.btnLinkToLoginScreen); registerErrorMsg = (TextView) findViewById(R.id.register_error); // Register Button Click event btnRegister.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { String name = inputFullName.getText().toString(); String email = inputEmail.getText().toString(); String password = inputPassword.getText().toString(); UserFunctions userFunction = new UserFunctions(); JSONObject json = userFunction.registerUser(name, email, password); // check for login response try { if (json.getString(KEY_SUCCESS) != null) { registerErrorMsg.setText(""); String res = json.getString(KEY_SUCCESS); if(Integer.parseInt(res) == 1){ // user successfully registred // Store user details in SQLite Database DatabaseHandler db = new DatabaseHandler(getApplicationContext()); JSONObject json_user = json.getJSONObject("user"); // Clear all previous data in database userFunction.logoutUser(getApplicationContext()); db.addUser(json_user.getString(KEY_NAME), json_user.getString(KEY_EMAIL), json.getString(KEY_UID), json_user.getString(KEY_CREATED_AT)); // Launch Dashboard Screen Intent dashboard = new Intent(getApplicationContext(), DashboardActivity.class); // Close all views before launching Dashboard dashboard.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(dashboard); // Close Registration Screen finish(); }else{ // Error in registration registerErrorMsg.setText("Error occured in registration"); } } } catch (JSONException e) { e.printStackTrace(); } } }); // Link to Login Screen btnLinkToLogin.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Intent i = new Intent(getApplicationContext(), LoginActivity.class); startActivity(i); // Close Registration View finish(); } }); } }

    Read the article

  • need to add secure ftp file upload area to a client's website

    - by user346602
    This is a variation on a previous question as I am having tons of trouble finding answers in all my relentless online searches. Am designing a website for an architecture firm. They want their clients to be able to upload files to them, through a link on their site, via ftp. They also want to have a sign in for their clients, and ensure the uploads are secure. I can figure out how to make a form that has a file upload area - but just don't understand the ftp and the secure part... I understand html, css and a bit of JQuery; the rest is still very challenging to me. Have found something called net2ftp that claims to do what I'm looking for - but the even the installation instructions (for administrators, here: http://www.net2ftp.com/help.html) confuse me. Do I need a MySQL database? Where do I put in Admin password they refer to? It goes on... Is there anything "easier" out there that anyone knows of? I have read that I should be Googling "file managers" - but don't know if these can be embedded in a client's website. I even need to understand of what happens to said file, and where it ends up, when client clicks the upload link. Oh - I am so in over head on this one.

    Read the article

  • Sending files from server to client in Java

    - by Lee Jacobson
    Hi, I'm trying to find a way to send files of different file types from a server to a client. I have this code on the server to put the file into a byte array: File file = new File(resourceLocation); byte[] b = new byte[(int) file.length()]; FileInputStream fileInputStream; try { fileInputStream = new FileInputStream(file); try { fileInputStream.read(b); } catch (IOException ex) { System.out.println("Error, Can't read from file"); } for (int i = 0; i < b.length; i++) { fileData += (char)b[i]; } } catch (FileNotFoundException e) { System.out.println("Error, File Not Found."); } I then send fileData as a string to the client. This works fine for txt files but when it comes to images I find that although it creates the file fine with the data in, the image won't open. I'm not sure if I'm even going about this the right way. Thanks for the help.

    Read the article

  • Client-server synchronization pattern / algorithm?

    - by tm_lv
    I have a feeling that there must be client-server synchronization patterns out there. But i totally failed to google up one. Situation is quite simple - server is the central node, that multiple clients connect to and manipulate same data. Data can be split in atoms, in case of conflict, whatever is on server, has priority (to avoid getting user into conflict solving). Partial synchronization is preferred due to potentially large amounts of data. Are there any patterns / good practices for such situation, or if you don't know of any - what would be your approach? Below is how i now think to solve it: Parallel to data, a modification journal will be held, having all transactions timestamped. When client connects, it receives all changes since last check, in consolidated form (server goes through lists and removes additions that are followed by deletions, merges updates for each atom, etc.). Et voila, we are up to date. Alternative would be keeping modification date for each record, and instead of performing data deletes, just mark them as deleted. Any thoughts?

    Read the article

  • Understanding Async Concept in WebServices

    - by 8EM
    I've had the thrill recently of developing web service applications. Most of my experience is with GWT and mainly doing most things on the client side then doing an async call back for any additional data needed. However at the moment, I want a process that will be triggered on the client side, then on the server side, a loop will occur, where if a certain condition is met, it will 'push' back to the client. This will hopefully remove the processor usage on the client side and also saves bandwidth. What is this called? I understand 'polling' is where the client side continuously hits a server, however what I want is the opposite. Is this possible? Am I misunderstanding what happened when I trigger an AsyncService in GWT? Please advise. EDIT: Just for further clarification: Having some kind of weather data service. Where, you trigger 'go' on the client side, then on the server side, it checks to see the degrees, if it has moved since last time, it will spit back the degrees to the client, if it hasn't, it will keep looping.

    Read the article

  • odd behavior with C# ftp client class

    - by geoff
    I found an ftp client class in c# over a year ago and have been using it in a process that uploads files on a nightly basis. A few days ago we started having a problem where it would time out. I'm not well versed in this so I'm not sure why it's doing this. When the program starts uploading a file it checks to see if it's logged in and if not, it calls the login method. In that method is this block of code. if (this.resultCode != 230) { this.sendCommand("PASS " + password); if (!(this.resultCode == 230 || this.resultCode == 202)) { this.cleanup(); throw new FtpException(this.result.Substring(4)); } } On the line that says this.sendCommand("PASS"... it goes into this code. private void sendCommand(String command) { if (this.verboseDebugging) Debug.WriteLine(command, "FtpClient"); Byte[] cmdBytes = Encoding.ASCII.GetBytes((command + "\r\n").ToCharArray()); clientSocket.Send(cmdBytes, cmdBytes.Length, 0); this.readResponse(); } If I let the program run, it times out. However if I step through it into the sendCommand method it executes fine. Does anyone know why it would work fine when I step through it? Nothing on our end has changed and I've been told nothing on the client's end has changed so I'm stumped. Thanks.

    Read the article

  • Transferring HashMap between client and server using Sockets (JAVA)

    - by sar
    I am working on a JAVA project in which there are multiple terminals. These terminals act as client and servers. For example if there are 3 terminals A,B and C.Then at any given point in time one of them say A, will be a client making broadcast request. The other two terminals, B and C, will reply. I am using sockets to make them communicate. Once the reply is received from all the other terminals A will check the pool of channels to see if any one of the channel is free. It takes up the free channel and making it availabilty false. The channelpool is implemented using HashMAp: HashMap channelpool = new HashMap(); channelpool = 1=true, 2=true, 3=false, 4=true, 5=true, 6=true, 7=true, 8=true, 9=true, 10=true So initially all the channels are true, any terminal can take any channel. But once the channel is taken it is set to false for the period of use and then reset to true. Now this Hashmap has to be shared among the distributed terminals. Also it should be kept up to date. I can not used a shared resource among the terminals to store the HashMap.Can someone tell me an easy way to transfer the HashMap between the terminals. I will appreciate if someone could point me to a website which discusses this.

    Read the article

  • Transparent proxy which preserves client mac address

    - by A G
    I have a customer that wants to intercept SSL traffic as it leaves their network. My proposed solution is to setup a proxy that is transparent and both layer 2 and layer 3 so it can simply be dropped into their network without any change in config required. The proxy has two NICs, one connected to the server, the other to the client. The client, proxy and gateway are under control of the customer, the server is not. For example: client --- Proxy --- gateway -|- server I have my proxy program configured with IP_TRANSPARENT socket option to it can respond to connections destined for a remote IP. I am using the following setup: iptables -t mangle -A PREROUTING -p tcp --dport 80 -j TPROXY --on-port 3128 --tproxy-mark 1/1 iptables -t mangle -A PREROUTING -p tcp -j MARK --set-mark 1 ip rule add fwmark 1/1 table 1 ip route add local 0.0.0.0/0 dev lo table 1 The client in question is on its own subnet and has been configured so that the proxy is the default gateway. The result is: Client sends a frame to the proxy; source IP is client, source mac is client, destination IP is server, destination mac is proxy Proxy forwards this frame to the gateway; source IP is proxy, source mac is proxy, destination IP is server, destination mac is gateway Gateway forwards this to the server and gets a response back. Gateway sends reply back to proxy; source IP is server, source mac is gateway, destination IP is proxy, destination mac is proxy Proxy forwards this reply to client; source IP is server, source mac is proxy, destination IP is client, destination mac is client. The tproxy and iptables configuration lets the proxy send packets with a non local ip address. Is there a way to make something transparent at the mac address level? That is, put the client on the same subnet as the gateway. The gateway sees the source IP and mac as that of the client, even though they originated from the proxy. Could this be done by configuring the proxy as a bridge then use ebtables to escalate the traffic to be handled by iptables? When I use ebtables to push something up to iptables, it appears my proxy program doesn't respond to the packets as they are destined for the gateways's mac address, not the proxy's. What are some other potential avenues I could investigate? EDIT: When the client and gateway are on different subnets (and client has set the proxy as the gateway), it works as described in 1 to 5. But I want to know if it is possible to have the client and gateway on the same subnet and have the proxy fully transparent (ie client is not aware of the proxy). Thanks! EDIT 2: I can configure the proxy as a bridge using brctl, but cannot find a way to direct this traffic to my proxy program - asked here Possible for linux bridge to intercept traffic?. Currently, with the description numbered 1 to 5, it operates at layer 3; it is transparent on the client side (client thinks it is talking to the server's IP), but not on the gateway side (gateway is talking to the proxy's IP). What I want to find out is, is it possible to make this operate at layer 2, so it is fully transparent? What are the available options I should research? Thanks

    Read the article

  • ActiveMQ AJax Client

    - by Lily
    I try to write a simple Ajax client to send and receive messages. It's successfully deployed but I have never received msg from the client. I am beating myself to think out what I am missing, but still can't make it work. Here is my code: I creat a dynamic web application named: ActiveMQAjaxService and put activemq-web.jar and all neccessary dependencies in the WEB-INF/lib folder. In this way, AjaxServlet and MessageServlet will be deployed I start activemq server in command line: ./activemq = activemq successfully created and display: Listening for connections at: tcp://lilyubuntu:61616 INFO | Connector openwire Started INFO | ActiveMQ JMS Message Broker (localhost, ID:lilyubuntu-56855-1272317001405-0:0) started INFO | Logging to org.slf4j.impl.JCLLoggerAdapter(org.mortbay.log) via org.mortbay.log.Slf4jLog INFO | jetty-6.1.9 INFO | ActiveMQ WebConsole initialized. INFO | Initializing Spring FrameworkServlet 'dispatcher' INFO | ActiveMQ Console at http://0.0.0.0:8161/admin INFO | Initializing Spring root WebApplicationContext INFO | Connector vm://localhost Started INFO | Camel Console at http://0.0.0.0:8161/camel INFO | ActiveMQ Web Demos at http://0.0.0.0:8161/demo INFO | RESTful file access application at http://0.0.0.0:8161/fileserver INFO | Started [email protected]:8161 3) index.xml, which is the html to test the client: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script type="text/javascript" src="amq/amq.js"></script> <script type="text/javascript">amq.uri='amq';</script> <title>Hello Ajax ActiveMQ</title> </head> <body> <p>Hello World!</p> <script type="text/javascript"> amq.sendMessage("topic://myDetector", "message"); var myHandler = { rcvMessage: function(message) { alert("received "+message); } }; function myPoll(first) { if (first) { amq.addListener('myDetector', 'topic://myDetector', myHandler.rcvMessage); } } amq.addPollHandler(myPoll); 4) Web.xml: ActiveMQ Web Demos Apache ActiveMQ Web Demos org.apache.activemq.brokerURL vm://localhost (I also tried tcp://localhost:61616) The URL of the Message Broker to connect to org.apache.activemq.embeddedBroker true Whether we should include an embedded broker or not <!-- the subscription REST servlet --> <servlet> <servlet-name>AjaxServlet</servlet-name> <servlet-class>org.apache.activemq.web.AjaxServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet> <servlet-name>MessageServlet</servlet-name> <servlet-class>org.apache.activemq.web.MessageServlet</servlet-class> <load-on-startup>1</load-on-startup> <!-- Uncomment this parameter if you plan to use multiple consumers over REST <init-param> <param-name>destinationOptions</param-name> <param-value>consumer.prefetchSize=1</param-value> </init-param> --> </servlet> <!-- the queue browse servlet --> <filter> <filter-name>session</filter-name> <filter-class>org.apache.activemq.web.SessionFilter</filter-class> </filter> <filter-mapping> <filter-name>session</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> After all of these, I deploy the web-app, and it's successfully deployed, but when I try it out in http://localhost:8080/ActiveMQAjaxService/index.html , nothing happens. I can run the demo portfolioPublisher demo successfully at http://localhost:8161/demo/portfolio/portfolio.html, and see the numbers updated all the time. But for my simple web-app, nothing really works. Any suggestion/hint is welcomed. Thanks so much Lily

    Read the article

  • Java Client-Server problem when sending multiple files

    - by Jim
    Client public void transferImage() { File file = new File(ServerStats.clientFolder); String[] files = file.list(); int numFiles = files.length; boolean done = false; BufferedInputStream bis; BufferedOutputStream bos; int num; byte[] byteArray; long count; long len; Socket socket = null ; while (!done){ try{ socket = new Socket(ServerStats.imgServerName,ServerStats.imgServerPort) ; InputStream inStream = socket.getInputStream() ; OutputStream outStream = socket.getOutputStream() ; System.out.println("Connected to : " + ServerStats.imgServerName); BufferedReader inm = new BufferedReader(new InputStreamReader(inStream)); PrintWriter out = new PrintWriter(outStream, true /* autoFlush */); for (int itor = 0; itor < numFiles; itor++) { String fileName = files[itor]; System.out.println("transfer: " + fileName); File sentFile = new File(fileName); len = sentFile.length(); len++; System.out.println(len); out.println(len); out.println(sentFile); //SENDFILE bis = new BufferedInputStream(new FileInputStream(fileName)); bos = new BufferedOutputStream(socket.getOutputStream( )); byteArray = new byte[1000000]; count = 0; while ( count < len ){ num = bis.read(byteArray); bos.write(byteArray,0,num); count++; } bos.close(); bis.close(); System.out.println("file done: " + itor); } done = true; }catch (Exception e) { System.err.println(e) ; } } } Server public static void main(String[] args) { BufferedInputStream bis; BufferedOutputStream bos; int num; File file = new File(ServerStats.serverFolder); if (!(file.exists())){ file.mkdir(); } try { int i = 1; ServerSocket socket = new ServerSocket(ServerStats.imgServerPort); Socket incoming = socket.accept(); System.out.println("Spawning " + i); try { try{ if (!(file.exists())){ file.mkdir(); } InputStream inStream = incoming.getInputStream(); OutputStream outStream = incoming.getOutputStream(); BufferedReader inm = new BufferedReader(new InputStreamReader(inStream)); PrintWriter out = new PrintWriter(outStream, true /* autoFlush */); String length2 = inm.readLine(); System.out.println(length2); String filename = inm.readLine(); System.out.println("Filename = " + filename); out.println("ACK: Filename received = " + filename); //RECIEVE and WRITE FILE byte[] receivedData = new byte[1000000]; bis = new BufferedInputStream(incoming.getInputStream()); bos = new BufferedOutputStream(new FileOutputStream(ServerStats.serverFolder + "/" + filename)); long length = (long)Integer.parseInt(length2); length++; long counter = 0; while (counter < length){ num = bis.read(receivedData); bos.write(receivedData,0,num); counter ++; } System.out.println(counter); bos.close(); bis.close(); File receivedFile = new File(filename); long receivedLen = receivedFile.length(); out.println("ACK: Length of received file = " + receivedLen); } finally { incoming.close(); } } catch (IOException e){ e.printStackTrace(); } } catch (IOException e1){ e1.printStackTrace(); } } The code is some I found, and I have slightly modified it, but I am having problems transferring multiple images over the server. Output on Client: run ServerQueue.Client Connected to : localhost transfer: Picture 012.jpg 1312743 java.lang.ArrayIndexOutOfBoundsException Connected to : localhost transfer: Picture 012.jpg 1312743 Cant seem to get it to transfer multiple images. But bothsides I think crash or something because the file never finishes transfering

    Read the article

  • OpenSSL in C++ email client - server closes connection with TLSv1 Alert message

    - by mice
    My app connects to a IMAP email server. One client configured his server to reject SSLv2 certificates, and now my app fails to connect to the server. All other email clients connect to this server successfully. My app uses openssl. I debugged by creating minimal openssl client and attempt to connect to the server. Below is the code with connects to the mail server (using Windows sockets, but same problem is with unix sockets). Server sends its initial IMAP greeting message, but after client sends 1st command, server closes connection. In Wireshark, I see that after sending command to server, it returns TLSv1 error message 21 (Encrypted Alert) and connection is gone. I'm looking for proper setup of OpenSSL for this connection to succeed. Thanks #include <stdio.h> #include <memory.h> #include <errno.h> #include <sys/types.h> #include <winsock2.h> #include <openssl/crypto.h> #include <openssl/x509.h> #include <openssl/pem.h> #include <openssl/ssl.h> #include <openssl/err.h> #define CHK_NULL(x) if((x)==NULL) exit(1) #define CHK_ERR(err,s) if((err)==-1) { perror(s); exit(1); } #define CHK_SSL(err) if((err)==-1) { ERR_print_errors_fp(stderr); exit(2); } SSL *ssl; char buf[4096]; void write(const char *s){ int err = SSL_write(ssl, s, strlen(s)); printf("> %s\n", s); CHK_SSL(err); } void read(){ int n = SSL_read(ssl, buf, sizeof(buf) - 1); CHK_SSL(n); if(n==0){ printf("Finished\n"); exit(1); } buf[n] = 0; printf("%s\n", buf); } void main(){ int err=0; SSLeay_add_ssl_algorithms(); SSL_METHOD *meth = SSLv23_client_method(); SSL_load_error_strings(); SSL_CTX *ctx = SSL_CTX_new(meth); CHK_NULL(ctx); WSADATA data; WSAStartup(0x202, &data); int sd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); CHK_ERR(sd, "socket"); struct sockaddr_in sa; memset(&sa, 0, sizeof(sa)); sa.sin_family = AF_INET; sa.sin_addr.s_addr = inet_addr("195.137.27.14"); sa.sin_port = htons(993); err = connect(sd,(struct sockaddr*) &sa, sizeof(sa)); CHK_ERR(err, "connect"); /* ----------------------------------------------- */ /* Now we have TCP connection. Start SSL negotiation. */ ssl = SSL_new(ctx); CHK_NULL(ssl); SSL_set_fd(ssl, sd); err = SSL_connect(ssl); CHK_SSL(err); // Following two steps are optional and not required for data exchange to be successful. /* printf("SSL connection using %s\n", SSL_get_cipher(ssl)); X509 *server_cert = SSL_get_peer_certificate(ssl); CHK_NULL(server_cert); printf("Server certificate:\n"); char *str = X509_NAME_oneline(X509_get_subject_name(server_cert),0,0); CHK_NULL(str); printf(" subject: %s\n", str); OPENSSL_free(str); str = X509_NAME_oneline(X509_get_issuer_name (server_cert),0,0); CHK_NULL(str); printf(" issuer: %s\n", str); OPENSSL_free(str); // We could do all sorts of certificate verification stuff here before deallocating the certificate. X509_free(server_cert); */ printf("\n\n"); read(); // get initial IMAP greeting write("1 CAPABILITY\r\n"); // send 1st command read(); // get reply to cmd; server closes connection here write("2 LOGIN a b\r\n"); read(); SSL_shutdown(ssl); closesocket(sd); SSL_free(ssl); SSL_CTX_free(ctx); }

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >